You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior: tsc should reconcile "string" to be a member of the string literal type in defined at $schema.declarations.name.type.
Actual behavior:
$ tsc
index.ts:9:7 - error TS2322: Type '{ $schema: { declarations: { name: { type: string; }; }; }; }' is not assignable to type 'Schema'.
The types of '$schema.declarations' are incompatible between these types.
Type '{ name: { type: string; }; }' is not assignable to type 'Record<string, { type: "string" | "number"; }>'.
Property '"name"' is incompatible with index signature.
Type '{ type: string; }' is not assignable to type '{ type: "string" | "number"; }'.
Types of property 'type' are incompatible.
Type 'string' is not assignable to type '"string" | "number"'.
9 const usage: Schema = json
~~~~~
Found 1 error.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 4.0.2 and 4.1.0-dev.20200821
Search Terms:
json module tagged union typescript
json module string literal type typescript
brings up https://stackoverflow.com/questions/54352128/typescript-convert-string-in-json-to-string-literal with no answer.Code
https://github.com/wegry/json-modules-and-string-literal-types
with a
index.json
like so.Expected behavior:
tsc
should reconcile "string" to be a member of the string literal type in defined at$schema.declarations.name.type
.Actual behavior:
The text was updated successfully, but these errors were encountered: