mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update LKG.
This commit is contained in:
+1
-1
@@ -61,7 +61,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.versionMajorMinor = "3.3";
|
||||
ts.version = ts.versionMajorMinor + ".3333";
|
||||
ts.version = ts.versionMajorMinor + ".4000";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
ts.emptyArray = [];
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.3";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".3333";
|
||||
ts.version = ts.versionMajorMinor + ".4000";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
|
||||
Vendored
+16
-36
@@ -14,7 +14,7 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
declare namespace ts {
|
||||
const versionMajorMinor = "3.3";
|
||||
const versionMajorMinor = "3.2";
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version: string;
|
||||
}
|
||||
@@ -1726,18 +1726,15 @@ declare namespace ts {
|
||||
}
|
||||
interface InputFiles extends Node {
|
||||
kind: SyntaxKind.InputFiles;
|
||||
javascriptPath?: string;
|
||||
javascriptText: string;
|
||||
javascriptMapPath?: string;
|
||||
javascriptMapText?: string;
|
||||
declarationPath?: string;
|
||||
declarationText: string;
|
||||
declarationMapPath?: string;
|
||||
declarationMapText?: string;
|
||||
}
|
||||
interface UnparsedSource extends Node {
|
||||
kind: SyntaxKind.UnparsedSource;
|
||||
fileName?: string;
|
||||
text: string;
|
||||
sourceMapPath?: string;
|
||||
sourceMapText?: string;
|
||||
@@ -1781,7 +1778,7 @@ declare namespace ts {
|
||||
type ResolvedConfigFileName = string & {
|
||||
_isResolvedConfigFileName: never;
|
||||
};
|
||||
type WriteFileCallback = (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: ReadonlyArray<SourceFile>) => void;
|
||||
type WriteFileCallback = (fileName: string, data: string, writeByteOrderMark: boolean, onError: ((message: string) => void) | undefined, sourceFiles?: ReadonlyArray<SourceFile>) => void;
|
||||
class OperationCanceledException {
|
||||
}
|
||||
interface CancellationToken {
|
||||
@@ -2217,7 +2214,6 @@ declare namespace ts {
|
||||
}
|
||||
interface UniqueESSymbolType extends Type {
|
||||
symbol: Symbol;
|
||||
escapedName: __String;
|
||||
}
|
||||
interface StringLiteralType extends LiteralType {
|
||||
value: string;
|
||||
@@ -2693,6 +2689,7 @@ declare namespace ts {
|
||||
getDefaultLibLocation?(): string;
|
||||
writeFile: WriteFileCallback;
|
||||
getCurrentDirectory(): string;
|
||||
getDirectories(path: string): string[];
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
@@ -3009,14 +3006,13 @@ declare namespace ts {
|
||||
}
|
||||
interface UserPreferences {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "auto" | "double" | "single";
|
||||
readonly quotePreference?: "double" | "single";
|
||||
readonly includeCompletionsForModuleExports?: boolean;
|
||||
readonly includeCompletionsWithInsertText?: boolean;
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
|
||||
readonly importModuleSpecifierEnding?: "minimal" | "index" | "js";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
readonly providePrefixAndSuffixTextForRename?: boolean;
|
||||
}
|
||||
/** Represents a bigint literal value without requiring bigint support */
|
||||
interface PseudoBigInt {
|
||||
@@ -3101,7 +3097,6 @@ declare namespace ts {
|
||||
scanJsxIdentifier(): SyntaxKind;
|
||||
scanJsxAttributeValue(): SyntaxKind;
|
||||
reScanJsxToken(): JsxTokenSyntaxKind;
|
||||
reScanLessThanToken(): SyntaxKind;
|
||||
scanJsxToken(): JsxTokenSyntaxKind;
|
||||
scanJSDocToken(): JsDocSyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
@@ -3983,11 +3978,9 @@ declare namespace ts {
|
||||
function updateCommaList(node: CommaListExpression, elements: ReadonlyArray<Expression>): CommaListExpression;
|
||||
function createBundle(sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource | InputFiles>): Bundle;
|
||||
function createUnparsedSourceFile(text: string): UnparsedSource;
|
||||
function createUnparsedSourceFile(inputFile: InputFiles, type: "js" | "dts"): UnparsedSource;
|
||||
function createUnparsedSourceFile(text: string, mapPath: string | undefined, map: string | undefined): UnparsedSource;
|
||||
function createInputFiles(javascriptText: string, declarationText: string): InputFiles;
|
||||
function createInputFiles(readFileText: (path: string) => string | undefined, javascriptPath: string, javascriptMapPath: string | undefined, declarationPath: string, declarationMapPath: string | undefined): InputFiles;
|
||||
function createInputFiles(javascriptText: string, declarationText: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
|
||||
function createInputFiles(javascript: string, declaration: string): InputFiles;
|
||||
function createInputFiles(javascript: string, declaration: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
|
||||
function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource>): Bundle;
|
||||
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>): CallExpression;
|
||||
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
|
||||
@@ -4285,10 +4278,6 @@ declare namespace ts {
|
||||
* Get the syntax diagnostics, for all source files if source file is not supplied
|
||||
*/
|
||||
getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<Diagnostic>;
|
||||
/**
|
||||
* Get the declaration diagnostics, for all source files if source file is not supplied
|
||||
*/
|
||||
getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray<DiagnosticWithLocation>;
|
||||
/**
|
||||
* Get all the dependencies of the file
|
||||
*/
|
||||
@@ -4375,11 +4364,13 @@ declare namespace ts {
|
||||
/** If provided, will be used to reset existing delayed compilation */
|
||||
clearTimeout?(timeoutId: any): void;
|
||||
}
|
||||
interface ProgramHost<T extends BuilderProgram> {
|
||||
interface WatchCompilerHost<T extends BuilderProgram> extends WatchHost {
|
||||
/**
|
||||
* Used to create the program when need for program creation or recreation detected
|
||||
*/
|
||||
createProgram: CreateProgram<T>;
|
||||
/** If provided, callback to invoke after every new program creation */
|
||||
afterProgramCreate?(program: T): void;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
getNewLine(): string;
|
||||
getCurrentDirectory(): string;
|
||||
@@ -4413,10 +4404,6 @@ declare namespace ts {
|
||||
/** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
|
||||
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
|
||||
}
|
||||
interface WatchCompilerHost<T extends BuilderProgram> extends ProgramHost<T>, WatchHost {
|
||||
/** If provided, callback to invoke after every new program creation */
|
||||
afterProgramCreate?(program: T): void;
|
||||
}
|
||||
/**
|
||||
* Host to create watch with root files and options
|
||||
*/
|
||||
@@ -4719,8 +4706,8 @@ declare namespace ts {
|
||||
getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan | undefined;
|
||||
getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan | undefined;
|
||||
getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined;
|
||||
getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo;
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray<RenameLocation> | undefined;
|
||||
getRenameInfo(fileName: string, position: number): RenameInfo;
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): ReadonlyArray<RenameLocation> | undefined;
|
||||
getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
|
||||
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined;
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
|
||||
@@ -5163,9 +5150,6 @@ declare namespace ts {
|
||||
canRename: false;
|
||||
localizedErrorMessage: string;
|
||||
}
|
||||
interface RenameInfoOptions {
|
||||
readonly allowRenameOfImportPath?: boolean;
|
||||
}
|
||||
interface SignatureHelpParameter {
|
||||
name: string;
|
||||
documentation: SymbolDisplayPart[];
|
||||
@@ -7925,7 +7909,7 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
interface UserPreferences {
|
||||
readonly disableSuggestions?: boolean;
|
||||
readonly quotePreference?: "auto" | "double" | "single";
|
||||
readonly quotePreference?: "double" | "single";
|
||||
/**
|
||||
* If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
|
||||
* This affects lone identifier completions but not completions on the right hand side of `obj.`.
|
||||
@@ -7939,8 +7923,6 @@ declare namespace ts.server.protocol {
|
||||
readonly importModuleSpecifierPreference?: "relative" | "non-relative";
|
||||
readonly allowTextChangesInNewFiles?: boolean;
|
||||
readonly lazyConfiguredProjectsFromExternalProject?: boolean;
|
||||
readonly providePrefixAndSuffixTextForRename?: boolean;
|
||||
readonly allowRenameOfImportPath?: boolean;
|
||||
}
|
||||
interface CompilerOptions {
|
||||
allowJs?: boolean;
|
||||
@@ -8515,6 +8497,10 @@ declare namespace ts.server {
|
||||
syntaxOnly?: boolean;
|
||||
}
|
||||
class ProjectService {
|
||||
/**
|
||||
* Container of all known scripts
|
||||
*/
|
||||
private readonly filenameToScriptInfo;
|
||||
private readonly scriptInfoInNodeModulesWatchers;
|
||||
/**
|
||||
* Contains all the deleted script info's version information so that
|
||||
@@ -8613,9 +8599,6 @@ declare namespace ts.server {
|
||||
getHostFormatCodeOptions(): FormatCodeSettings;
|
||||
getHostPreferences(): protocol.UserPreferences;
|
||||
private onSourceFileChanged;
|
||||
private handleSourceMapProjects;
|
||||
private delayUpdateSourceInfoProjects;
|
||||
private delayUpdateProjectsOfScriptInfoPath;
|
||||
private handleDeletedFile;
|
||||
private onConfigChangedForConfiguredProject;
|
||||
/**
|
||||
@@ -8706,8 +8689,6 @@ declare namespace ts.server {
|
||||
*/
|
||||
getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
|
||||
getScriptInfoForPath(fileName: Path): ScriptInfo | undefined;
|
||||
private addSourceInfoToSourceMap;
|
||||
private addMissingSourceMapFile;
|
||||
setHostConfiguration(args: protocol.ConfigureRequestArguments): void;
|
||||
closeLog(): void;
|
||||
/**
|
||||
@@ -8745,7 +8726,6 @@ declare namespace ts.server {
|
||||
private findExternalProjectContainingOpenScriptInfo;
|
||||
openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult;
|
||||
private removeOrphanConfiguredProjects;
|
||||
private removeOrphanScriptInfos;
|
||||
private telemetryOnOpenFile;
|
||||
/**
|
||||
* Close file whose contents is managed by the client
|
||||
|
||||
+1
-95
@@ -84,7 +84,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.3";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".3333";
|
||||
ts.version = ts.versionMajorMinor + ".4000";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -110030,40 +110030,6 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
var fixId = "addNameToNamelessParameter";
|
||||
var errorCodes = [ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: errorCodes,
|
||||
getCodeActions: function (context) {
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
||||
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_parameter_name, fixId, ts.Diagnostics.Add_names_to_all_parameters_without_names)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { return makeChange(changes, diag.file, diag.start); }); },
|
||||
});
|
||||
function makeChange(changeTracker, sourceFile, pos) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, pos);
|
||||
if (!ts.isIdentifier(token)) {
|
||||
return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.formatSyntaxKind(token.kind));
|
||||
}
|
||||
var param = token.parent;
|
||||
if (!ts.isParameter(param)) {
|
||||
return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.formatSyntaxKind(token.kind));
|
||||
}
|
||||
var i = param.parent.parameters.indexOf(param);
|
||||
ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
|
||||
ts.Debug.assert(i > -1, "Parameter not found in parent parameter list.");
|
||||
var replacement = ts.createParameter(
|
||||
/*decorators*/ undefined, param.modifiers, param.dotDotDotToken, "arg" + i, param.questionToken, ts.createTypeReferenceNode(token, /*typeArguments*/ undefined), param.initializer);
|
||||
changeTracker.replaceNode(sourceFile, token, replacement);
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@@ -113080,40 +113046,6 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
var fixId = "addMissingNewOperator";
|
||||
var errorCodes = [ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: errorCodes,
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile, span = context.span;
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingNewOperator(t, sourceFile, span); });
|
||||
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_new_operator_to_call, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
||||
return addMissingNewOperator(changes, context.sourceFile, diag);
|
||||
}); },
|
||||
});
|
||||
function addMissingNewOperator(changes, sourceFile, span) {
|
||||
var call = ts.cast(findAncestorMatchingSpan(sourceFile, span), ts.isCallExpression);
|
||||
var newExpression = ts.createNew(call.expression, call.typeArguments, call.arguments);
|
||||
changes.replaceNode(sourceFile, call, newExpression);
|
||||
}
|
||||
function findAncestorMatchingSpan(sourceFile, span) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
||||
var end = ts.textSpanEnd(span);
|
||||
while (token.end < end) {
|
||||
token = token.parent;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@@ -113399,32 +113331,6 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
var fixId = "enableExperimentalDecorators";
|
||||
var errorCodes = [
|
||||
ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning.code
|
||||
];
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: errorCodes,
|
||||
getCodeActions: function (context) {
|
||||
var configFile = context.program.getCompilerOptions().configFile;
|
||||
if (configFile === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return makeChange(changeTracker, configFile); });
|
||||
return [codefix.createCodeFixActionNoFixId(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
});
|
||||
function makeChange(changeTracker, configFile) {
|
||||
codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.createTrue());
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
|
||||
+1
-95
@@ -75,7 +75,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.3";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".3333";
|
||||
ts.version = ts.versionMajorMinor + ".4000";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -110021,40 +110021,6 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
var fixId = "addNameToNamelessParameter";
|
||||
var errorCodes = [ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: errorCodes,
|
||||
getCodeActions: function (context) {
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
||||
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_parameter_name, fixId, ts.Diagnostics.Add_names_to_all_parameters_without_names)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { return makeChange(changes, diag.file, diag.start); }); },
|
||||
});
|
||||
function makeChange(changeTracker, sourceFile, pos) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, pos);
|
||||
if (!ts.isIdentifier(token)) {
|
||||
return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.formatSyntaxKind(token.kind));
|
||||
}
|
||||
var param = token.parent;
|
||||
if (!ts.isParameter(param)) {
|
||||
return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.formatSyntaxKind(token.kind));
|
||||
}
|
||||
var i = param.parent.parameters.indexOf(param);
|
||||
ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
|
||||
ts.Debug.assert(i > -1, "Parameter not found in parent parameter list.");
|
||||
var replacement = ts.createParameter(
|
||||
/*decorators*/ undefined, param.modifiers, param.dotDotDotToken, "arg" + i, param.questionToken, ts.createTypeReferenceNode(token, /*typeArguments*/ undefined), param.initializer);
|
||||
changeTracker.replaceNode(sourceFile, token, replacement);
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@@ -113071,40 +113037,6 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
var fixId = "addMissingNewOperator";
|
||||
var errorCodes = [ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: errorCodes,
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile, span = context.span;
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingNewOperator(t, sourceFile, span); });
|
||||
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_new_operator_to_call, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
||||
return addMissingNewOperator(changes, context.sourceFile, diag);
|
||||
}); },
|
||||
});
|
||||
function addMissingNewOperator(changes, sourceFile, span) {
|
||||
var call = ts.cast(findAncestorMatchingSpan(sourceFile, span), ts.isCallExpression);
|
||||
var newExpression = ts.createNew(call.expression, call.typeArguments, call.arguments);
|
||||
changes.replaceNode(sourceFile, call, newExpression);
|
||||
}
|
||||
function findAncestorMatchingSpan(sourceFile, span) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
||||
var end = ts.textSpanEnd(span);
|
||||
while (token.end < end) {
|
||||
token = token.parent;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@@ -113390,32 +113322,6 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
var fixId = "enableExperimentalDecorators";
|
||||
var errorCodes = [
|
||||
ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning.code
|
||||
];
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: errorCodes,
|
||||
getCodeActions: function (context) {
|
||||
var configFile = context.program.getCompilerOptions().configFile;
|
||||
if (configFile === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return makeChange(changeTracker, configFile); });
|
||||
return [codefix.createCodeFixActionNoFixId(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
});
|
||||
function makeChange(changeTracker, configFile) {
|
||||
codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.createTrue());
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
|
||||
@@ -75,7 +75,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.3";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".3333";
|
||||
ts.version = ts.versionMajorMinor + ".4000";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -110021,40 +110021,6 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
var fixId = "addNameToNamelessParameter";
|
||||
var errorCodes = [ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: errorCodes,
|
||||
getCodeActions: function (context) {
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
||||
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_parameter_name, fixId, ts.Diagnostics.Add_names_to_all_parameters_without_names)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { return makeChange(changes, diag.file, diag.start); }); },
|
||||
});
|
||||
function makeChange(changeTracker, sourceFile, pos) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, pos);
|
||||
if (!ts.isIdentifier(token)) {
|
||||
return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.formatSyntaxKind(token.kind));
|
||||
}
|
||||
var param = token.parent;
|
||||
if (!ts.isParameter(param)) {
|
||||
return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.formatSyntaxKind(token.kind));
|
||||
}
|
||||
var i = param.parent.parameters.indexOf(param);
|
||||
ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
|
||||
ts.Debug.assert(i > -1, "Parameter not found in parent parameter list.");
|
||||
var replacement = ts.createParameter(
|
||||
/*decorators*/ undefined, param.modifiers, param.dotDotDotToken, "arg" + i, param.questionToken, ts.createTypeReferenceNode(token, /*typeArguments*/ undefined), param.initializer);
|
||||
changeTracker.replaceNode(sourceFile, token, replacement);
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@@ -113071,40 +113037,6 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
var fixId = "addMissingNewOperator";
|
||||
var errorCodes = [ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: errorCodes,
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile, span = context.span;
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingNewOperator(t, sourceFile, span); });
|
||||
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_new_operator_to_call, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
||||
return addMissingNewOperator(changes, context.sourceFile, diag);
|
||||
}); },
|
||||
});
|
||||
function addMissingNewOperator(changes, sourceFile, span) {
|
||||
var call = ts.cast(findAncestorMatchingSpan(sourceFile, span), ts.isCallExpression);
|
||||
var newExpression = ts.createNew(call.expression, call.typeArguments, call.arguments);
|
||||
changes.replaceNode(sourceFile, call, newExpression);
|
||||
}
|
||||
function findAncestorMatchingSpan(sourceFile, span) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
||||
var end = ts.textSpanEnd(span);
|
||||
while (token.end < end) {
|
||||
token = token.parent;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
@@ -113390,32 +113322,6 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
var fixId = "enableExperimentalDecorators";
|
||||
var errorCodes = [
|
||||
ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning.code
|
||||
];
|
||||
codefix.registerCodeFix({
|
||||
errorCodes: errorCodes,
|
||||
getCodeActions: function (context) {
|
||||
var configFile = context.program.getCompilerOptions().configFile;
|
||||
if (configFile === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return makeChange(changeTracker, configFile); });
|
||||
return [codefix.createCodeFixActionNoFixId(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)];
|
||||
},
|
||||
fixIds: [fixId],
|
||||
});
|
||||
function makeChange(changeTracker, configFile) {
|
||||
codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.createTrue());
|
||||
}
|
||||
})(codefix = ts.codefix || (ts.codefix = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var codefix;
|
||||
(function (codefix) {
|
||||
|
||||
@@ -88,7 +88,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.3";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".3333";
|
||||
ts.version = ts.versionMajorMinor + ".4000";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
|
||||
Reference in New Issue
Block a user