Skip to content

[BUG] Mapped type becomes undefined #20

@miro-ku

Description

@miro-ku

Hi there, I have some trouble using this library in my project. This was working in firelordjs@<=2.4, don't know if it works in firelordjs@>=2.5, didn't check yet

  1. Version?
    2.4.15
  2. What is the Meta Type?
import type { MetaTypeCreator } from 'firelord';

type SomeObject = {
  key: string;
};

type FirestoreDummyData = {
  string: string; // ok
  array: string[]; // ok
  number: number; // ok
  regular_object: {
    test: string;
  }; // ok
  mapped_primitive: Record<string, string>; // becomes undefined
  mapped_object: Record<string, SomeObject>; // becomes undefined too
};

export type DummyMetaType = MetaTypeCreator<FirestoreDummyData, 'Dummy'>;

const test: DummyMetaType['read'] = {
  string: 'test', // ok
  array: ['test'], // ok
  number: 10, // ok
  regular_object: { test: 'test' }, // ok
  mapped_primitive: { // TS2322: Type '{ test: string; }' is not assignable to type 'undefined'.
    test: 'test',
  },
  mapped_object: {  // TS2322: Type '{ test: { key: string; }; }' is not assignable to type 'undefined'.
    test: {
      key: 'test',
    },
  },
};
  1. What operations are you trying to run?
    I'm trying to use mapped object in meta type
  2. What do you expect?
    Mapped type should work as intended
  3. What is actually happening?
    Mapped type becomes undefined in resulted MetaType['read']

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions