API Breaking Changes - zhengbli/TypeScript GitHub Wiki

TypeScript 1.7

  • ts.parseConfigFile has been renamed to ts.parseJsonConfigFileContent

TypeScript 1.6

CompilerHost interface change (comparing to TypeScript 1.6 beta)

  • return type of CompilerHost.resolveModuleNames was changed from string[] to ResolvedModule[]. Extra optional property isExternalLibraryImport in ResolvedModule interface denotes if Program 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)

TypeScript 1.5

Program interface changes

  • TypeChecker.emitFiles is no longer available; use Program.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()

Tip: use ts.getPreEmitDiagnostics(program) to get syntactic, semantic, and global diagnostics for all files

All usages of 'filename' and 'Filename' changed to 'fileName' and 'FileName'

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.

Changes to TextChange

TextChange.start and TextChange.length became properties instead of methods.

SourceFile.getLineAndCharacterFromPosition

SourceFile.getLineAndCharacterFromPosition became SourceFile.getLineAndCharacterOfPosition

APIs made internal as they are not intended for use outside of the compiler

We did some cleanup to the public interfaces, here is the full list of changes:

typescript_internal.d.ts and typescriptServices_internal.d.ts have been removed

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.