Skip to content

Commit fd72a1c

Browse files
committed
@typescript-eslint/unified-signatures
1 parent 3b7f3da commit fd72a1c

File tree

10 files changed

+19
-22
lines changed

10 files changed

+19
-22
lines changed

src/compiler/core.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -993,9 +993,9 @@ namespace ts {
993993
*/
994994
export function compact<T>(array: (T | undefined | null | false | 0 | "")[]): T[];
995995
export function compact<T>(array: readonly (T | undefined | null | false | 0 | "")[]): readonly T[];
996-
// TSLint thinks these can be combined with the above - they cannot; they'd produce higher-priority inferences and prevent the falsey types from being stripped
997-
export function compact<T>(array: T[]): T[];
998-
export function compact<T>(array: readonly T[]): readonly T[];
996+
// ESLint thinks these can be combined with the above - they cannot; they'd produce higher-priority inferences and prevent the falsey types from being stripped
997+
export function compact<T>(array: T[]): T[]; // eslint-disable-line @typescript-eslint/unified-signatures
998+
export function compact<T>(array: readonly T[]): readonly T[]; // eslint-disable-line @typescript-eslint/unified-signatures
999999
export function compact<T>(array: T[]): T[] {
10001000
let result: T[] | undefined;
10011001
if (array) {

src/compiler/factory.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ namespace ts {
6565

6666
// Literals
6767

68-
/* @internal */ export function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier, isSingleQuote: boolean): StringLiteral;
68+
/* @internal */ export function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier, isSingleQuote: boolean): StringLiteral; // eslint-disable-line @typescript-eslint/unified-signatures
6969
/** If a node is passed, creates a string literal whose source text is read from a source node during emit. */
7070
export function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier): StringLiteral;
7171
export function createLiteral(value: number | PseudoBigInt): NumericLiteral;
@@ -126,7 +126,7 @@ namespace ts {
126126

127127
export function createIdentifier(text: string): Identifier;
128128
/* @internal */
129-
export function createIdentifier(text: string, typeArguments: readonly (TypeNode | TypeParameterDeclaration)[] | undefined): Identifier;
129+
export function createIdentifier(text: string, typeArguments: readonly (TypeNode | TypeParameterDeclaration)[] | undefined): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures
130130
export function createIdentifier(text: string, typeArguments?: readonly (TypeNode | TypeParameterDeclaration)[]): Identifier {
131131
const node = <Identifier>createSynthesizedNode(SyntaxKind.Identifier);
132132
node.escapedText = escapeLeadingUnderscores(text);
@@ -141,7 +141,7 @@ namespace ts {
141141

142142
export function updateIdentifier(node: Identifier): Identifier;
143143
/* @internal */
144-
export function updateIdentifier(node: Identifier, typeArguments: NodeArray<TypeNode | TypeParameterDeclaration> | undefined): Identifier;
144+
export function updateIdentifier(node: Identifier, typeArguments: NodeArray<TypeNode | TypeParameterDeclaration> | undefined): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures
145145
export function updateIdentifier(node: Identifier, typeArguments?: NodeArray<TypeNode | TypeParameterDeclaration> | undefined): Identifier {
146146
return node.typeArguments !== typeArguments
147147
? updateNode(createIdentifier(idText(node), typeArguments), node)
@@ -205,7 +205,7 @@ namespace ts {
205205

206206
/** Create a unique name generated for a node. */
207207
export function getGeneratedNameForNode(node: Node | undefined): Identifier;
208-
/* @internal */ export function getGeneratedNameForNode(node: Node | undefined, flags: GeneratedIdentifierFlags): Identifier;
208+
/* @internal */ export function getGeneratedNameForNode(node: Node | undefined, flags: GeneratedIdentifierFlags): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures
209209
export function getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier {
210210
const name = createIdentifier(node && isIdentifier(node) ? idText(node) : "");
211211
name.autoGenerateFlags = GeneratedIdentifierFlags.Node | flags!;
@@ -3151,7 +3151,7 @@ namespace ts {
31513151
}
31523152

31533153
function asEmbeddedStatement<T extends Node>(statement: T): T | EmptyStatement;
3154-
function asEmbeddedStatement<T extends Node>(statement: T | undefined): T | EmptyStatement | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
3154+
function asEmbeddedStatement<T extends Node>(statement: T | undefined): T | EmptyStatement | undefined;
31553155
function asEmbeddedStatement<T extends Node>(statement: T | undefined): T | EmptyStatement | undefined {
31563156
return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginalNode(createEmptyStatement(), statement), statement) : statement;
31573157
}

src/compiler/moduleNameResolver.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ namespace ts {
922922
}
923923

924924
export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
925-
/* @internal */ export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, lookupConfig?: boolean): ResolvedModuleWithFailedLookupLocations;
925+
/* @internal */ export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, lookupConfig?: boolean): ResolvedModuleWithFailedLookupLocations; // eslint-disable-line @typescript-eslint/unified-signatures
926926
export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, lookupConfig?: boolean): ResolvedModuleWithFailedLookupLocations {
927927
return nodeModuleNameResolverWorker(moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
928928
}

src/compiler/program.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ namespace ts {
317317
}
318318

319319
export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[];
320-
/*@internal*/ export function getPreEmitDiagnostics(program: BuilderProgram, sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[];
320+
/*@internal*/ export function getPreEmitDiagnostics(program: BuilderProgram, sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; // eslint-disable-line @typescript-eslint/unified-signatures
321321
export function getPreEmitDiagnostics(program: Program | BuilderProgram, sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[] {
322322
const diagnostics = [
323323
...program.getConfigFileParsingDiagnostics(),

src/compiler/scanner.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ namespace ts {
352352

353353
export function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number;
354354
/* @internal */
355-
export function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number, allowEdits?: true): number;
355+
export function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number, allowEdits?: true): number; // eslint-disable-line @typescript-eslint/unified-signatures
356356
export function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number, allowEdits?: true): number {
357357
return sourceFile.getPositionOfLineAndCharacter ?
358358
sourceFile.getPositionOfLineAndCharacter(line, character, allowEdits) :

src/compiler/types.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3170,10 +3170,10 @@ namespace ts {
31703170
/* @internal */ typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): TypeNode | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
31713171
/** Note that the resulting nodes cannot be checked. */
31723172
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined;
3173-
/* @internal */ signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
3173+
/* @internal */ signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): SignatureDeclaration & {typeArguments?: NodeArray<TypeNode>} | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
31743174
/** Note that the resulting nodes cannot be checked. */
31753175
indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration | undefined;
3176-
/* @internal */ indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): IndexSignatureDeclaration | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
3176+
/* @internal */ indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, tracker?: SymbolTracker): IndexSignatureDeclaration | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
31773177
/** Note that the resulting nodes cannot be checked. */
31783178
symbolToEntityName(symbol: Symbol, meaning: SymbolFlags, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): EntityName | undefined;
31793179
/** Note that the resulting nodes cannot be checked. */
@@ -5965,7 +5965,7 @@ namespace ts {
59655965
// If fileName is provided, gets all the diagnostics associated with that file name.
59665966
// Otherwise, returns all the diagnostics (global and file associated) in this collection.
59675967
getDiagnostics(): Diagnostic[];
5968-
getDiagnostics(fileName: string): DiagnosticWithLocation[]; // eslint-disable-line @typescript-eslint/unified-signatures
5968+
getDiagnostics(fileName: string): DiagnosticWithLocation[];
59695969

59705970
reattachFileDiagnostics(newFile: SourceFile): void;
59715971
}

src/compiler/utilities.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7747,7 +7747,7 @@ namespace ts {
77477747
/**
77487748
* Gets a relative path that can be used to traverse between `from` and `to`.
77497749
*/
7750-
export function getRelativePathFromDirectory(fromDirectory: string, to: string, getCanonicalFileName: GetCanonicalFileName): string;
7750+
export function getRelativePathFromDirectory(fromDirectory: string, to: string, getCanonicalFileName: GetCanonicalFileName): string; // eslint-disable-line @typescript-eslint/unified-signatures
77517751
export function getRelativePathFromDirectory(fromDirectory: string, to: string, getCanonicalFileNameOrIgnoreCase: GetCanonicalFileName | boolean) {
77527752
Debug.assert((getRootLength(fromDirectory) > 0) === (getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
77537753
const getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : identity;

src/server/editorServices.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ namespace ts.server {
663663

664664
updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse): void;
665665
/** @internal */
666-
updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse | BeginInstallTypes | EndInstallTypes): void;
666+
updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse | BeginInstallTypes | EndInstallTypes): void; // eslint-disable-line @typescript-eslint/unified-signatures
667667
updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse | BeginInstallTypes | EndInstallTypes): void {
668668
const project = this.findProject(response.projectName);
669669
if (!project) {

src/server/scriptInfo.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,7 @@ namespace ts.server {
595595
*/
596596
lineOffsetToPosition(line: number, offset: number): number;
597597
/*@internal*/
598-
// eslint-disable-next-line @typescript-eslint/unified-signatures
599-
lineOffsetToPosition(line: number, offset: number, allowEdits?: true): number;
598+
lineOffsetToPosition(line: number, offset: number, allowEdits?: true): number; // eslint-disable-line @typescript-eslint/unified-signatures
600599
lineOffsetToPosition(line: number, offset: number, allowEdits?: true): number {
601600
return this.textStorage.lineOffsetToPosition(line, offset, allowEdits);
602601
}

src/services/types.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ namespace ts {
55
getChildAt(index: number, sourceFile?: SourceFile): Node;
66
getChildren(sourceFile?: SourceFile): Node[];
77
/* @internal */
8-
getChildren(sourceFile?: SourceFileLike): Node[];
8+
getChildren(sourceFile?: SourceFileLike): Node[]; // eslint-disable-line @typescript-eslint/unified-signatures
99
getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
1010
/* @internal */
11-
getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number;
11+
getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures
1212
getFullStart(): number;
1313
getEnd(): number;
1414
getWidth(sourceFile?: SourceFileLike): number;
@@ -339,7 +339,6 @@ namespace ts {
339339
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: readonly number[], formatOptions: FormatCodeSettings, preferences: UserPreferences): readonly CodeFixAction[];
340340
getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings, preferences: UserPreferences): CombinedCodeActions;
341341

342-
/* eslint-disable @typescript-eslint/unified-signatures */
343342
applyCodeActionCommand(action: CodeActionCommand, formatSettings?: FormatCodeSettings): Promise<ApplyCodeActionCommandResult>;
344343
applyCodeActionCommand(action: CodeActionCommand[], formatSettings?: FormatCodeSettings): Promise<ApplyCodeActionCommandResult[]>;
345344
applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[], formatSettings?: FormatCodeSettings): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
@@ -349,7 +348,6 @@ namespace ts {
349348
applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
350349
/** @deprecated `fileName` will be ignored */
351350
applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
352-
/* eslint-enable @typescript-eslint/unified-signatures */
353351

354352
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined): ApplicableRefactorInfo[];
355353
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;

0 commit comments

Comments
 (0)