tmp.ts:1:7 - error TS2322: Type '1' is not assignable to type '"1"'.
1 const invalidNum: `${1}` = 1;
~~~~~~~~~~
tmp.ts:3:7 - error TS2322: Type '"2"' is not assignable to type '"1"'.
3 const invalidNum3: `${1}` = "2";
~~~~~~~~~~~
Ezno
in:
error:
┌─ tmp.ts:2:29
│
2 │ const invalidNum2: `${1}` = "1";
│ ----- ^^^ Type "1" is not assignable to type string
│ │
│ Variable declared with type string
error:
┌─ tmp.ts:3:29
│
3 │ const invalidNum3: `${1}` = "2";
│ ----- ^^^ Type "2" is not assignable to type string
│ │
│ Variable declared with type string
Hmm, that is strange. I know that the string literal types are encoded by additions. So `A ${T}` = "A" + T. Maybe 1 + 0 = 1 so that is why it passes. Will investigate in #209
TSC
in:
out:
Ezno
in: