-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
PR #106 introduces a helper type that makes TS not forget the branding when defining a new record type. This is currently only applied to the value type of the record, as applying it to the key type breaks .literal() on records with branded keys:
type BrandedString = The<typeof BrandedString>;
const BrandedString = string.withBrand('BrandedString');
type BrandedKVRecord = The<typeof BrandedKVRecord>;
// Assuming this record remembers the branding on the keytype.
const BrandedKVRecord = record(BrandedString, BrandedString);
expectTypeOf(BrandedKVRecord.literal({
a: 'b', // TS error: argument of type { a: string } not assignable to [...]
})).toEqual<Record<BrandedString, BrandedString>>();This seems to be a problem stemming from DeepUnbranded<T> not properly dealing with the branded key type.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels