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
import*astsfrom"typescript";constregistry=ts.createDocumentRegistry();constsourceFile=registry.acquireDocument("/file.ts",{},ts.ScriptSnapshot.fromString(""),"1");console.log(sourceFile.languageVersion);// undefined, but languageVersion is not nullable
Expected behavior: Not sure. Probably it should default to ScriptTarget.Latest or the compiler options should pass through the function that sets the default values.
Actual behavior:languageVersion is undefined because it was not set on the compiler options.
I took a look around the code and it defaults to ES3 in program.ts though. Maybe we should do the same here? What's the rationale for choosing one or the other?
Low priority issue, but the following is possible which can lead to errors when using the compiler API.
TypeScript Version: 3.1.0-dev.20180818
Search Terms: DocumentRegistry, languageVersion undefined
Code
Caused by the non-null assertion here.
Expected behavior: Not sure. Probably it should default to
ScriptTarget.Latest
or the compiler options should pass through the function that sets the default values.Actual behavior:
languageVersion
is undefined because it was not set on the compiler options.Related issues: Maybe #18217 covers this already.
The text was updated successfully, but these errors were encountered: