Skip to content

Commit 4160f3d

Browse files
committed
add return types
1 parent 6a05d4b commit 4160f3d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/ts-autocomplete/src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,16 @@ function getVirtualLanguageService(): [
5454
];
5555
}
5656

57-
function mapCompletions(completions: ts.CompletionInfo) {
57+
type AutoCompletion = {
58+
name: string;
59+
kind: ts.ScriptElementKind;
60+
type: string;
61+
};
62+
63+
function mapCompletions(completions: ts.CompletionInfo): AutoCompletion[] {
5864
return completions.entries.map((entry) => {
5965
const declarations = entry.symbol?.getDeclarations();
66+
console.log(declarations.length);
6067
let type = 'any';
6168
if (declarations?.[0]) {
6269
const decl = declarations[0];
@@ -79,7 +86,7 @@ export default class Autocompleter {
7986
[this.languageService, this.updateCode] = getVirtualLanguageService();
8087
}
8188

82-
autocomplete(code: string, position?: number) {
89+
autocomplete(code: string, position?: number): AutoCompletion[] {
8390
if (typeof position === 'undefined') {
8491
position = code.length;
8592
}

0 commit comments

Comments
 (0)