Some cleanup around inlay hints types to get more-precise checking. (#45391)

* Some cleanup around inlay hints types to get more-precise checking.

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
This commit is contained in:
Daniel Rosenwasser 2021-08-23 16:15:54 -07:00 committed by GitHub
parent b8ace9d312
commit af54990055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 17 deletions

View File

@ -653,7 +653,7 @@ namespace ts.server {
return response.body!.map(item => ({ // TODO: GH#18217
...item,
kind: item.kind as InlayHintKind | undefined,
kind: item.kind as InlayHintKind,
position: this.lineOffsetToPosition(file, item.position),
}));
}

View File

@ -2562,11 +2562,7 @@ namespace ts.server.protocol {
body?: SignatureHelpItems;
}
export const enum InlayHintKind {
Type = "Type",
Parameter = "Parameter",
Enum = "Enum",
}
export type InlayHintKind = "Type" | "Parameter" | "Enum";
export interface InlayHintsRequestArgs extends FileRequestArgs {
/**
@ -2587,7 +2583,7 @@ namespace ts.server.protocol {
export interface InlayHintItem {
text: string;
position: Location;
kind?: InlayHintKind;
kind: InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
}

View File

@ -1452,7 +1452,7 @@ namespace ts.server {
});
}
private provideInlayHints(args: protocol.InlayHintsRequestArgs) {
private provideInlayHints(args: protocol.InlayHintsRequestArgs): readonly protocol.InlayHintItem[] {
const { file, project } = this.getFileAndProject(args);
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!;
const hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));

View File

@ -720,7 +720,7 @@ namespace ts {
export interface InlayHint {
text: string;
position: number;
kind?: InlayHintKind;
kind: InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
}

View File

@ -5887,7 +5887,7 @@ declare namespace ts {
interface InlayHint {
text: string;
position: number;
kind?: InlayHintKind;
kind: InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
}
@ -8740,11 +8740,7 @@ declare namespace ts.server.protocol {
interface SignatureHelpResponse extends Response {
body?: SignatureHelpItems;
}
enum InlayHintKind {
Type = "Type",
Parameter = "Parameter",
Enum = "Enum"
}
type InlayHintKind = "Type" | "Parameter" | "Enum";
interface InlayHintsRequestArgs extends FileRequestArgs {
/**
* Start position of the span.
@ -8762,7 +8758,7 @@ declare namespace ts.server.protocol {
interface InlayHintItem {
text: string;
position: Location;
kind?: InlayHintKind;
kind: InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
}

View File

@ -5887,7 +5887,7 @@ declare namespace ts {
interface InlayHint {
text: string;
position: number;
kind?: InlayHintKind;
kind: InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
}