Closed TomPenguin closed 1 year ago
I'd like to add nullable in this case.
nullable
I couldn't find any problems with following:
yarn test
and
const undefinedTestTypeSchema: Describe<undefined> = literal(undefined) const nullTestTypeSchema: Describe<null> = literal(null) const optionalTestTypeSchema: Describe<string | undefined> = optional(string()) const partialEnumTypeSchema: Describe<{ foo?: 'bar' | 'baz' }> = object({ foo: optional(enums(['bar', 'baz'] as const)), }) const partialAndNullableEnumTypeSchema: Describe<{ foo?: 'bar' | 'baz' | null }> = object({ foo: optional(nullable(enums(['bar', 'baz'] as const))), }) const nullableEnumTypeSchema: Describe<{ foo: 'bar' | 'baz' | null }> = object({ foo: nullable(enums(['bar', 'baz'] as const)), }) const optionalUndefinedSchema: Describe<{ foo?: undefined }> = object({ foo: literal(undefined), }) const optionalNullSchema: Describe<{ foo?: null }> = object({ foo: optional(literal(null)), })
Thanks @TomPenguin! Can you add some typings tests to account for the new allowed behavior? (I should have asked for this on that other PR as well.)
I'd like to add
nullable
in this case.I couldn't find any problems with following:
and