Skip to content

Commit 10a18f9

Browse files
Some cleanup around inlay hints types to get more-precise checking.
1 parent 8cdcec4 commit 10a18f9

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/server/protocol.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,11 +2562,7 @@ namespace ts.server.protocol {
25622562
body?: SignatureHelpItems;
25632563
}
25642564

2565-
export const enum InlayHintKind {
2566-
Type = "Type",
2567-
Parameter = "Parameter",
2568-
Enum = "Enum",
2569-
}
2565+
export type InlayHintKind = "Type" | "Parameter" | "Enum";
25702566

25712567
export interface InlayHintsRequestArgs extends FileRequestArgs {
25722568
/**
@@ -2587,7 +2583,7 @@ namespace ts.server.protocol {
25872583
export interface InlayHintItem {
25882584
text: string;
25892585
position: Location;
2590-
kind?: InlayHintKind;
2586+
kind: InlayHintKind;
25912587
whitespaceBefore?: boolean;
25922588
whitespaceAfter?: boolean;
25932589
}

src/server/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ namespace ts.server {
14521452
});
14531453
}
14541454

1455-
private provideInlayHints(args: protocol.InlayHintsRequestArgs) {
1455+
private provideInlayHints(args: protocol.InlayHintsRequestArgs): readonly protocol.InlayHintItem[] {
14561456
const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
14571457
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!;
14581458
const hints = languageService.provideInlayHints(file, args, this.getPreferences(file));

src/services/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ namespace ts {
720720
export interface InlayHint {
721721
text: string;
722722
position: number;
723-
kind?: InlayHintKind;
723+
kind: InlayHintKind;
724724
whitespaceBefore?: boolean;
725725
whitespaceAfter?: boolean;
726726
}

0 commit comments

Comments
 (0)