use TypeScript 2.1.5

This commit is contained in:
Johannes Rieken 2017-01-16 15:29:14 +01:00
parent 8cbd548f8e
commit f5f4706596
6 changed files with 45170 additions and 24693 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,7 @@ import Emitter = monaco.Emitter;
import IEvent = monaco.IEvent; import IEvent = monaco.IEvent;
import IDisposable = monaco.IDisposable; import IDisposable = monaco.IDisposable;
declare var require:<T>(moduleId:[string], callback:(module:T)=>void)=>void; declare var require: <T>(moduleId: [string], callback: (module: T) => void) => void;
// --- TypeScript configuration and defaults --------- // --- TypeScript configuration and defaults ---------
@ -29,7 +29,7 @@ export class LanguageServiceDefaultsImpl implements monaco.languages.typescript.
this.setDiagnosticsOptions(diagnosticsOptions); this.setDiagnosticsOptions(diagnosticsOptions);
} }
get onDidChange(): IEvent<monaco.languages.typescript.LanguageServiceDefaults>{ get onDidChange(): IEvent<monaco.languages.typescript.LanguageServiceDefaults> {
return this._onDidChange.event; return this._onDidChange.event;
} }
@ -99,34 +99,45 @@ enum ModuleKind {
AMD = 2, AMD = 2,
UMD = 3, UMD = 3,
System = 4, System = 4,
ES6 = 5,
ES2015 = 5, ES2015 = 5,
} }
enum JsxEmit { enum JsxEmit {
None = 0, None = 0,
Preserve = 1, Preserve = 1,
React = 2, React = 2,
} }
enum NewLineKind { enum NewLineKind {
CarriageReturnLineFeed = 0, CarriageReturnLineFeed = 0,
LineFeed = 1, LineFeed = 1,
} }
interface LineAndCharacter {
line: number;
character: number;
}
enum ScriptKind {
Unknown = 0,
JS = 1,
JSX = 2,
TS = 3,
TSX = 4,
}
enum ScriptTarget { enum ScriptTarget {
ES3 = 0, ES3 = 0,
ES5 = 1, ES5 = 1,
ES6 = 2,
ES2015 = 2, ES2015 = 2,
Latest = 2, ES2016 = 3,
ES2017 = 4,
ESNext = 5,
Latest = 5,
}
enum LanguageVariant {
Standard = 0,
JSX = 1,
} }
enum ModuleResolutionKind { enum ModuleResolutionKind {
Classic = 1, Classic = 1,
NodeJs = 2, NodeJs = 2,
} }
// --- END enums copied from typescript to prevent loading the entire typescriptServices --- // --- END enums copied from typescript to prevent loading the entire typescriptServices ---
const typescriptDefaults = new LanguageServiceDefaultsImpl( const typescriptDefaults = new LanguageServiceDefaultsImpl(
@ -139,20 +150,20 @@ const javascriptDefaults = new LanguageServiceDefaultsImpl(
function getTypeScriptWorker(): monaco.Promise<any> { function getTypeScriptWorker(): monaco.Promise<any> {
return new monaco.Promise((resolve, reject) => { return new monaco.Promise((resolve, reject) => {
withMode((mode) => { withMode((mode) => {
mode.getTypeScriptWorker() mode.getTypeScriptWorker()
.then(resolve, reject); .then(resolve, reject);
}); });
}); });
} }
function getJavaScriptWorker(): monaco.Promise<any> { function getJavaScriptWorker(): monaco.Promise<any> {
return new monaco.Promise((resolve, reject) => { return new monaco.Promise((resolve, reject) => {
withMode((mode) => { withMode((mode) => {
mode.getJavaScriptWorker() mode.getJavaScriptWorker()
.then(resolve, reject); .then(resolve, reject);
}); });
}); });
} }
// Export API // Export API
@ -173,7 +184,7 @@ monaco.languages.typescript = createAPI();
// --- Registration to monaco editor --- // --- Registration to monaco editor ---
function withMode(callback:(module:typeof mode)=>void): void { function withMode(callback: (module: typeof mode) => void): void {
require<typeof mode>(['vs/language/typescript/src/mode'], callback); require<typeof mode>(['vs/language/typescript/src/mode'], callback);
} }

75
src/monaco.d.ts vendored
View file

@ -1,33 +1,32 @@
declare module monaco.languages.typescript { declare module monaco.languages.typescript {
export enum ModuleKind { enum ModuleKind {
None = 0, None = 0,
CommonJS = 1, CommonJS = 1,
AMD = 2, AMD = 2,
UMD = 3, UMD = 3,
System = 4, System = 4,
ES6 = 5,
ES2015 = 5, ES2015 = 5,
} }
enum JsxEmit {
export enum JsxEmit {
None = 0, None = 0,
Preserve = 1, Preserve = 1,
React = 2, React = 2,
} }
enum NewLineKind {
export enum NewLineKind {
CarriageReturnLineFeed = 0, CarriageReturnLineFeed = 0,
LineFeed = 1, LineFeed = 1,
} }
export enum ScriptTarget { enum ScriptTarget {
ES3 = 0, ES3 = 0,
ES5 = 1, ES5 = 1,
ES6 = 2,
ES2015 = 2, ES2015 = 2,
Latest = 2, ES2016 = 3,
ES2017 = 4,
ESNext = 5,
Latest = 5,
} }
export enum ModuleResolutionKind { export enum ModuleResolutionKind {
@ -35,58 +34,70 @@ declare module monaco.languages.typescript {
NodeJs = 2, NodeJs = 2,
} }
type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[];
interface CompilerOptions { interface CompilerOptions {
allowNonTsExtensions?: boolean; allowJs?: boolean;
allowSyntheticDefaultImports?: boolean;
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
alwaysStrict?: boolean;
baseUrl?: string;
charset?: string; charset?: string;
declaration?: boolean; declaration?: boolean;
diagnostics?: boolean; declarationDir?: string;
disableSizeLimit?: boolean;
emitBOM?: boolean; emitBOM?: boolean;
help?: boolean; emitDecoratorMetadata?: boolean;
init?: boolean; experimentalDecorators?: boolean;
forceConsistentCasingInFileNames?: boolean;
importHelpers?: boolean;
inlineSourceMap?: boolean; inlineSourceMap?: boolean;
inlineSources?: boolean; inlineSources?: boolean;
isolatedModules?: boolean;
jsx?: JsxEmit; jsx?: JsxEmit;
reactNamespace?: string; lib?: string[];
listFiles?: boolean;
locale?: string; locale?: string;
mapRoot?: string; mapRoot?: string;
maxNodeModuleJsDepth?: number;
module?: ModuleKind; module?: ModuleKind;
moduleResolution?: ModuleResolutionKind;
newLine?: NewLineKind; newLine?: NewLineKind;
noEmit?: boolean; noEmit?: boolean;
noEmitHelpers?: boolean; noEmitHelpers?: boolean;
noEmitOnError?: boolean; noEmitOnError?: boolean;
noErrorTruncation?: boolean; noErrorTruncation?: boolean;
noFallthroughCasesInSwitch?: boolean;
noImplicitAny?: boolean; noImplicitAny?: boolean;
noImplicitReturns?: boolean;
noImplicitThis?: boolean;
noUnusedLocals?: boolean;
noUnusedParameters?: boolean;
noImplicitUseStrict?: boolean;
noLib?: boolean; noLib?: boolean;
noResolve?: boolean; noResolve?: boolean;
out?: string; out?: string;
outFile?: string;
outDir?: string; outDir?: string;
outFile?: string;
preserveConstEnums?: boolean; preserveConstEnums?: boolean;
project?: string; project?: string;
reactNamespace?: string;
jsxFactory?: string;
removeComments?: boolean; removeComments?: boolean;
rootDir?: string; rootDir?: string;
rootDirs?: string[];
skipLibCheck?: boolean;
skipDefaultLibCheck?: boolean;
sourceMap?: boolean; sourceMap?: boolean;
sourceRoot?: string; sourceRoot?: string;
strictNullChecks?: boolean;
suppressExcessPropertyErrors?: boolean; suppressExcessPropertyErrors?: boolean;
suppressImplicitAnyIndexErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean;
target?: ScriptTarget; target?: ScriptTarget;
version?: boolean; traceResolution?: boolean;
watch?: boolean; types?: string[];
isolatedModules?: boolean; /** Paths used to compute primary types search locations */
experimentalDecorators?: boolean; typeRoots?: string[];
emitDecoratorMetadata?: boolean; [option: string]: CompilerOptionsValue | undefined;
moduleResolution?: ModuleResolutionKind;
allowUnusedLabels?: boolean;
allowUnreachableCode?: boolean;
noImplicitReturns?: boolean;
noFallthroughCasesInSwitch?: boolean;
forceConsistentCasingInFileNames?: boolean;
allowSyntheticDefaultImports?: boolean;
allowJs?: boolean;
noImplicitUseStrict?: boolean;
disableSizeLimit?: boolean;
[option: string]: string | number | boolean;
} }
export interface DiagnosticsOptions { export interface DiagnosticsOptions {