-
The following types/namespaces are now string enums:
ts.ScriptElementKind
,ts.HighlightSpanKind
,ts.ClassificationTypeNames
,protocol.CommandTypes
,protocol.IndentStyle
,protocol.JsxEmit
,protocol.ModuleKind
,protocol.ModuleResolutionKind
,protocol.NewLineKind
, andprotocol.ScriptTarget
. Also,ts.CommandNames
is now an alias forprotocol.CommandTypes
. -
The type
EnumLiteralType
was removed andLiteralType
is used instead.LiteralType
also replaces.text
with a.value
which may be either a number or string. See String valued members in enums. -
Declaration
does not have aname
property. TypeScript now recognize assignments in .js files as declarations in certain contexts, e.g.func.prototype.method = function() {..}
will be a declaration of membermethod
onfunc
. As a resultDeclaration
is not guaranteed to have aname
property as before. A new type was introducedNamedDeclaration
to take the place ofDeclaration
, andDeclaration
moved to be the base type of bothNamedDeclaration
andBinaryExpression
. Casting toNamedDeclaration
should be safe for non .js declarations. See microsoft/TypeScript#15594 for more details.
ts.Map<T>
is now a nativeMap<string, T>
or a shim. This affects theSymbolTable
type, exposed bySymbol.members
,Symbol.exports
, andSymbol.globalExports
.
ParseConfigHost
now require a new memberreadFile
to support configuration inheritance.
LanguageService.getSourceFile
is removed (microsoft/TypeScript#7584),LanguageService.getProgram().getSourceFile
should be used instead.
ts.parseConfigFile
has been renamed tots.parseJsonConfigFileContent
-
return type of
CompilerHost.resolveModuleNames
was changed fromstring[]
toResolvedModule[]
. Extra optional propertyisExternalLibraryImport
in ResolvedModule interface denotes ifProgram
should apply some particular set of policies to the resolved file. For example if Node resolver has resolved non-relative module name to the file in 'node_modules', then this file:- should be a 'd.ts' file
- should be an external module
- should not contain tripleslash references.
Rationale: files containing external typings should not pollute global scope (to avoid conflicts between different versions of the same package). Also such files should never be added to the list of compiled files (otherwise compiled .ts file might overwrite actual .js file with implementation of the package)
TypeChecker.emitFiles
is no longer available; useProgram.emit
instead.- Getting diagnostics are now all centralized on Program,
- for Syntactic diagnostics for a single file use:
Program.getSyntacticDiagnostics(sourceFile)
- for Syntactic diagnostics for all files use:
Program.getSyntacticDiagnostics()
- for Semantic diagnostics for a single file use:
Program.getSemanticDiagnostics(sourceFile)
- for Semantic diagnostics for all files use:
Program.getSemanticDiagnostics()
- for compiler options and global diagnostics use:
Program.getGlobalDiagnostics()
- for Syntactic diagnostics for a single file use:
Tip: use ts.getPreEmitDiagnostics(program) to get syntactic, semantic, and global diagnostics for all files
Here are the details:
CompilerHost.getDefaultLibFilename
=>CompilerHost.getDefaultLibFileName
SourceFile.filename
=>SourceFile.fileName
FileReference.filename
=>FileReference.fileName
LanguageServiceHost.getDefaultLibFilename
=>LanguageServiceHost.getDefaultLibFileName
LanguageServiceShimHost.getDefaultLibFilename
=>LanguageServiceShimHost.getDefaultLibFileName
The full list of APIs can be found in this commit
The syntacticClassifierAbsent
parameter for the Classifier.getClassificationsForLine is now required
See Pull Request #2051 for more details.
TextChange.start
and TextChange.length
became properties instead of methods.
SourceFile.getLineAndCharacterFromPosition
became SourceFile.getLineAndCharacterOfPosition
We did some cleanup to the public interfaces, here is the full list of changes:
- Commit 2ee134c6b3c0ec
- Commit 35dde28d44122c
- Commit c9ef4db99ac93bb1c166a
- Commit b4e5d5b0b460cc88a10db
The two files exposed helpers in the past that were not part of the supported TypeScript API. If you were using any of these APIs please file an issue to re-expose them; requests for exposing helper APIs will be triaged on a case-per-case basis.
For more information please see the full change.