From 4b7e6cfc2e981fbd005812d0ce5a3c0167f689e4 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 30 Mar 2015 19:33:15 -0700 Subject: [PATCH] addressed CR feedback, accepted baselines --- src/compiler/checker.ts | 6 +-- src/compiler/commandLineParser.ts | 4 ++ .../diagnosticInformationMap.generated.ts | 6 +++ src/compiler/diagnosticMessages.json | 25 +++++++++- src/compiler/emitter.ts | 9 +++- src/compiler/program.ts | 39 +++++++++++++--- src/compiler/utilities.ts | 7 +++ src/services/services.ts | 46 ++++++------------- .../baselines/reference/APISample_compile.js | 2 + .../reference/APISample_compile.types | 12 +++++ tests/baselines/reference/APISample_linter.js | 2 + .../reference/APISample_linter.types | 12 +++++ .../reference/APISample_transform.js | 2 + .../reference/APISample_transform.types | 12 +++++ .../baselines/reference/APISample_watcher.js | 2 + .../reference/APISample_watcher.types | 12 +++++ 16 files changed, 155 insertions(+), 43 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 58383e2b6f1..a5c83f8d3fa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -716,7 +716,7 @@ module ts { if (target) { let markAlias = (target === unknownSymbol && compilerOptions.separateCompilation) || - (target !== unknownSymbol && target.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target)); + (target !== unknownSymbol && (target.flags & SymbolFlags.Value) && !isConstEnumOrConstEnumOnlyModule(target)); if (markAlias) { markAliasSymbolAsReferenced(symbol); @@ -10231,7 +10231,7 @@ module ts { if (symbol.flags & SymbolFlags.ValueModule && symbol.declarations.length > 1 && !isInAmbientContext(node) - && isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + && isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation)) { let classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (getSourceFileOfNode(node) !== getSourceFileOfNode(classOrFunc)) { @@ -11285,7 +11285,7 @@ module ts { return true; } // const enums and modules that contain only const enums are not considered values from the emit perespective - return target !== unknownSymbol && target.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target); + return target !== unknownSymbol && target && target.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s: Symbol): boolean { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 4ba2da757e5..c91fef40321 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -117,6 +117,10 @@ module ts { type: "boolean", description: Diagnostics.Do_not_emit_comments_to_output, }, + { + name: "separateCompilation", + type: "boolean", + }, { name: "sourceMap", type: "boolean", diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 967afd171ba..a7bbe3a3ba2 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -165,6 +165,7 @@ module ts { Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, + Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -434,6 +435,11 @@ module ts { Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, + Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." }, + Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." }, + Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, + Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, + Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6e24afad80c..d3643e6536e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -651,7 +651,10 @@ "category": "Error", "code": 1207 }, - + "Cannot compile non-external modules when the '--separateCompilation' flag is provided.": { + "category": "Error", + "code": 1208 + }, "Duplicate identifier '{0}'.": { "category": "Error", "code": 2300 @@ -1729,6 +1732,26 @@ "category": "Error", "code": 5042 }, + "Option 'sourceMap' cannot be specified with option 'separateCompilation'.": { + "category": "Error", + "code": 5043 + }, + "Option 'declaration' cannot be specified with option 'separateCompilation'.": { + "category": "Error", + "code": 5044 + }, + "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'.": { + "category": "Error", + "code": 5045 + }, + "Option 'out' cannot be specified with option 'separateCompilation'.": { + "category": "Error", + "code": 5046 + }, + "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": { + "category": "Error", + "code": 5047 + }, "Concatenate and emit output to single file.": { "category": "Message", "code": 6001 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 366bb1856ea..bf58167bd8d 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1641,6 +1641,11 @@ module ts { } function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean { + if (compilerOptions.separateCompilation) { + // do not inline enum values in separate compilation mode + return false; + } + let constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); @@ -3874,7 +3879,7 @@ module ts { function shouldEmitEnumDeclaration(node: EnumDeclaration) { let isConstEnum = isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums; + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation; } function emitEnumDeclaration(node: EnumDeclaration) { @@ -3966,7 +3971,7 @@ module ts { } function shouldEmitModuleDeclaration(node: ModuleDeclaration) { - return isInstantiatedModule(node, compilerOptions.preserveConstEnums); + return isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation); } function emitModuleDeclaration(node: ModuleDeclaration) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index cb12e6da4d5..1deb4132317 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -454,6 +454,24 @@ module ts { } function verifyCompilerOptions() { + if (options.separateCompilation) { + if (options.sourceMap) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation)); + } + + if (options.declaration) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation)); + } + + if (options.noEmitOnError) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation)); + } + + if (options.out) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); + } + } + if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { @@ -468,12 +486,21 @@ module ts { let languageVersion = options.target || ScriptTarget.ES3; let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); - if (firstExternalModuleSourceFile && !options.module) { + if (options.separateCompilation) { if (!options.module && languageVersion < ScriptTarget.ES6) { - // We cannot use createDiagnosticFromNode because nodes do not have parents yet - let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } + + let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) ? f : undefined); + if (firstNonExternalModuleSourceFile) { + let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + } + } + else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) { + // We cannot use createDiagnosticFromNode because nodes do not have parents yet + let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } // Cannot specify module gen target when in es6 or above @@ -481,11 +508,11 @@ module ts { diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher)); } - // there has to be common source directory if user specified --outdir || --sourcRoot + // there has to be common source directory if user specified --outdir || --sourceRoot // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted if (options.outDir || // there is --outDir specified options.sourceRoot || // there is --sourceRoot specified - (options.mapRoot && // there is --mapRoot Specified and there would be multiple js files generated + (options.mapRoot && // there is --mapRoot specified and there would be multiple js files generated (!options.out || firstExternalModuleSourceFile !== undefined))) { let commonPathComponents: string[]; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9fa0674c25c..936d40e18d3 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -274,6 +274,13 @@ module ts { export function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan { let errorNode = node; switch (node.kind) { + case SyntaxKind.SourceFile: + let pos = skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); + if (pos === sourceFile.text.length) { + // file is empty - return span for the beginning of the file + return createTextSpan(0, 0); + } + return getSpanOfTokenAtPosition(sourceFile, pos); // This list is a work in progress. Add missing node kinds to improve their error // spans. case SyntaxKind.VariableDeclaration: diff --git a/src/services/services.ts b/src/services/services.ts index 2d5ce2d5f25..05e173e70bb 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1635,48 +1635,28 @@ module ts { sourceFile.scriptSnapshot = scriptSnapshot; } - export function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, syntaxErrors?: Diagnostic[]): string { + /* + * This function will compile source text from 'input' argument using specified compiler options. + * If not options are provided - it will use a set of default compiler options. + * Extra compiler options that will unconditionally be used bu this function are: + * - separateCompilation = true + * - allowNonTsExtensions = true + */ + export function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string { let options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); - // Single file transformation is only guaranteed to be correct inside an external module. - // External modules have their own scope and cannot contribute to internal modules outside their - // scope. - if (options.target !== ScriptTarget.ES6 && (!options.module || options.module === ModuleKind.None)) { - // TODO: add errors - } - - // In single file transformation the compiler does not have access to declaration sites. - // Const enum property accesses will not be detected if they are not in the same file as the enum. - // thus they are going to be emitted as normal propety access. To ensure correct behaviour at runtime, - // we need to generate the actual enum object so that the property accesses do not fail. - options.preserveConstEnums = true; - - // No reason to get declarations, we are only returning javascript - options.declaration = false; + options.separateCompilation = true; // Filename can be non-ts file. options.allowNonTsExtensions = true; - // enable relaxed emit rules - options.separateCompilation = true; - - // We are not resolving references or modules, or even including the default library. Disabling - // emit on error will block generating the output and has no meaningful use here. - options.noEmitOnError = false; - - // No resolution requests will be honored anyways. So do not do it - options.noResolve = true; - - // TODO (vladima): this should be enabled after adding support to inlinable source maps - options.sourceMap = false; - // Parse var inputFileName = fileName || "module.ts"; var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // Store syntactic diagnostics - if (syntaxErrors && sourceFile.parseDiagnostics) { - syntaxErrors.push(...sourceFile.parseDiagnostics); + if (diagnostics && sourceFile.parseDiagnostics) { + diagnostics.push(...sourceFile.parseDiagnostics); } // Output @@ -1698,6 +1678,10 @@ module ts { var program = ts.createProgram([inputFileName], options, compilerHost); + if (diagnostics) { + diagnostics.push(...program.getGlobalDiagnostics()); + } + // Emit program.emit(); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 3f0ba5f18cd..70e9f76115d 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1243,6 +1243,7 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; + separateCompilation?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -1984,6 +1985,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index eff47a4cb7b..f06e49fcba8 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -3984,6 +3984,9 @@ declare module "typescript" { watch?: boolean; >watch : boolean + separateCompilation?: boolean; +>separateCompilation : boolean + [option: string]: string | number | boolean; >option : string } @@ -6160,6 +6163,15 @@ declare module "typescript" { throwIfCancellationRequested(): void; >throwIfCancellationRequested : () => void } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; +>transpile : (input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]) => string +>input : string +>compilerOptions : CompilerOptions +>CompilerOptions : CompilerOptions +>fileName : string +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; >createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile >fileName : string diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index ab48f78affc..9387b52f4b9 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1274,6 +1274,7 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; + separateCompilation?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -2015,6 +2016,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 600bf5c6adc..c92c66afd2f 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -4130,6 +4130,9 @@ declare module "typescript" { watch?: boolean; >watch : boolean + separateCompilation?: boolean; +>separateCompilation : boolean + [option: string]: string | number | boolean; >option : string } @@ -6306,6 +6309,15 @@ declare module "typescript" { throwIfCancellationRequested(): void; >throwIfCancellationRequested : () => void } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; +>transpile : (input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]) => string +>input : string +>compilerOptions : CompilerOptions +>CompilerOptions : CompilerOptions +>fileName : string +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; >createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile >fileName : string diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index d40c078a150..fba3642d369 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1275,6 +1275,7 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; + separateCompilation?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -2016,6 +2017,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 4ea9c49d758..a7a898e01be 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -4080,6 +4080,9 @@ declare module "typescript" { watch?: boolean; >watch : boolean + separateCompilation?: boolean; +>separateCompilation : boolean + [option: string]: string | number | boolean; >option : string } @@ -6256,6 +6259,15 @@ declare module "typescript" { throwIfCancellationRequested(): void; >throwIfCancellationRequested : () => void } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; +>transpile : (input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]) => string +>input : string +>compilerOptions : CompilerOptions +>CompilerOptions : CompilerOptions +>fileName : string +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; >createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile >fileName : string diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index c53034c11d7..1a203faea44 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1312,6 +1312,7 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; + separateCompilation?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -2053,6 +2054,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 3903e169b4e..acbbfdb2eab 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -4253,6 +4253,9 @@ declare module "typescript" { watch?: boolean; >watch : boolean + separateCompilation?: boolean; +>separateCompilation : boolean + [option: string]: string | number | boolean; >option : string } @@ -6429,6 +6432,15 @@ declare module "typescript" { throwIfCancellationRequested(): void; >throwIfCancellationRequested : () => void } + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string; +>transpile : (input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]) => string +>input : string +>compilerOptions : CompilerOptions +>CompilerOptions : CompilerOptions +>fileName : string +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; >createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile >fileName : string