mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
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:
parent
b8ace9d312
commit
af54990055
@ -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),
|
||||
}));
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -720,7 +720,7 @@ namespace ts {
|
||||
export interface InlayHint {
|
||||
text: string;
|
||||
position: number;
|
||||
kind?: InlayHintKind;
|
||||
kind: InlayHintKind;
|
||||
whitespaceBefore?: boolean;
|
||||
whitespaceAfter?: boolean;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -5887,7 +5887,7 @@ declare namespace ts {
|
||||
interface InlayHint {
|
||||
text: string;
|
||||
position: number;
|
||||
kind?: InlayHintKind;
|
||||
kind: InlayHintKind;
|
||||
whitespaceBefore?: boolean;
|
||||
whitespaceAfter?: boolean;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user