Skip to content

Commit

Permalink
Some cleanup around inlay hints types to get more-precise checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed Aug 10, 2021
1 parent 8cdcec4 commit 10a18f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions src/server/protocol.ts
Expand Up @@ -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 {
/**
Expand All @@ -2587,7 +2583,7 @@ namespace ts.server.protocol {
export interface InlayHintItem {
text: string;
position: Location;
kind?: InlayHintKind;
kind: InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/session.ts
Expand Up @@ -1452,7 +1452,7 @@ namespace ts.server {
});
}

private provideInlayHints(args: protocol.InlayHintsRequestArgs) {
private provideInlayHints(args: protocol.InlayHintsRequestArgs): readonly protocol.InlayHintItem[] {
const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!;
const hints = languageService.provideInlayHints(file, args, this.getPreferences(file));
Expand Down
2 changes: 1 addition & 1 deletion src/services/types.ts
Expand Up @@ -720,7 +720,7 @@ namespace ts {
export interface InlayHint {
text: string;
position: number;
kind?: InlayHintKind;
kind: InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
}
Expand Down

0 comments on commit 10a18f9

Please sign in to comment.