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
Isolated modules means that an emitter only needs to see a single file to know how to emit it. In this case, the error is correct because the type of a impacts whether or not the enum has a reverse mapping or not, and is therefore disallowed as only tsc could know that via analyzing other files (while say, babel, could not).
Reading the linked issue, I think I get it now.. It just wasn't obvious from the error message - "but must have syntactically recognizable string syntax" - I was thinking somehow the type of the constant was ending up string instead of a specific string e.g. "A"
"Must have syntactically-recognizable string syntax" or in other words "we must be able to tell that this is a string (and not, say, a number) just from looking at the syntax", which is not the case here.
π Search Terms
error 5.5 beta "has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.5.0-beta&ssl=5&ssc=3&pln=1&pc=1#code/KYDwDg9gTgLgBAYwgOwM7wXAvHARAQVwG4AoE4ZAVwFs4AhOAbxLlbgENtEAaEgXyJA
π» Code
The playground doesn't reproduce - I guess it only happens when importing from another file
otherFile
π Actual behavior
'otherFile.c' has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled
π Expected behavior
No error like in 5.4 - or a better explanation of what I am doing wrong :/
Additional information about the issue
This seems to have also come up in the new errors report:
#57922
The text was updated successfully, but these errors were encountered: