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
// @resolveJsonModule: truetypeGender="male"|"female";constcorrect: {gender: Gender}={gender: "male"};// okayimport*asinputfrom"./example.json";// example.json contains {"gender": "male"}constincorrect: {gender: Gender}=input;// Type 'string' is not assignable to type 'Gender'
Expected behavior:
Correctly compiles
Actual behavior:
example.ts:7:7 - error TS2322: Type '{ "gender": string; }' is not assignable to type '{ gender: Gender; }'.
Types of property 'gender' are incompatible.
Type 'string' is not assignable to type 'Gender'.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
resolveJsonModule
String Literal Type
TS2322
Code
Expected behavior:
Correctly compiles
Actual behavior:
The text was updated successfully, but these errors were encountered: