-
Notifications
You must be signed in to change notification settings - Fork 0
API Breaking Changes
-
LanguageService.getSourceFile
is removed (https://github.com/Microsoft/TypeScript/pull/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.
TypeScript Language Basics
- Basic Types
- Interfaces
- Classes
- Namespaces and Modules
- Functions
- Generics
- Compiler Options
- tsconfig.json
- Integrating with Build Tools
- Nightly Builds
TypeScript Language Advanced
- Mixins
- Declaration Merging
- Type Inference
- Type Compatibility
- JSX
- Writing Declaration Files
- Typings for NPM packages
News
TypeScript Contributors
- Contributing to TypeScript
- TypeScript Design Goals
- Coding Guidelines
- Spec conformance testing
- Useful Links for TypeScript Issue Management
- Writing Good Design Proposals
- Compiler Internals
Building Tools for TypeScript
- Architectural Overview
- Using the Compiler API
- Using the Language Service API
- Dev Mode in Visual Studio
- Debugging Language Service in VS Code
FAQs