File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
packages/ts-autocomplete/src Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function getVirtualLanguageService(): [
15
15
allowJs : true ,
16
16
} ;
17
17
18
- const updateCode = ( newDef : Record < TypeFilename , string > ) => {
18
+ const updateCode = ( newDef : Record < TypeFilename , string > ) : void => {
19
19
for ( const [ key , value ] of Object . entries ( newDef ) ) {
20
20
codeHolder [ key ] = value ;
21
21
versions [ key ] = ( versions [ key ] ?? 1 ) + 1 ;
@@ -54,7 +54,13 @@ function getVirtualLanguageService(): [
54
54
] ;
55
55
}
56
56
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 [ ] {
58
64
return completions . entries . map ( ( entry ) => {
59
65
const declarations = entry . symbol ?. getDeclarations ( ) ;
60
66
let type = 'any' ;
@@ -79,7 +85,7 @@ export default class Autocompleter {
79
85
[ this . languageService , this . updateCode ] = getVirtualLanguageService ( ) ;
80
86
}
81
87
82
- autocomplete ( code : string , position ?: number ) {
88
+ autocomplete ( code : string , position ?: number ) : AutoCompletion [ ] {
83
89
if ( typeof position === 'undefined' ) {
84
90
position = code . length ;
85
91
}
You can’t perform that action at this time.
0 commit comments