v.optional generates incorrect TypeScript type in api
Generates correct type for
foo:But the type is incorrect (imprecise) in the api:
Notice that
| undefined is missing. This is a different type, and it matters when compilerOptions.exactOptionalPropertyTypes is set to true in tsconfig.I'd guess it's a bug in
Expand or in TS itself?