-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Getting is not assignable to type 'never' error on overriden field use:
export const CreatureV1Schema = joi.object({
name: joi.string().required(),
// accepts textual representation of the size ('big', 'normal', 'small' etc)
size: joi.string().required(),
});
export const CreatureV2Schema = CreatureV1Schema.keys({
// accepts size in meters now
size: joi.number().required(),
});
export type CreatureV2 = joi.extractType<typeof CreatureV2Schema>;
export const creatureV2: CreatureV2 = {
name: 'ogre',
// TS2322 error: Type 'number' is not assignable to type 'never'.
size: 3.5,
};CreatureV2 renders to
type CreatureV2 = {} & {
name: string;
size: string;
} & {} & {
size: number;
}Metadata
Metadata
Assignees
Labels
No labels