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(): [
1515 allowJs : true ,
1616 } ;
1717
18- const updateCode = ( newDef : Record < TypeFilename , string > ) => {
18+ const updateCode = ( newDef : Record < TypeFilename , string > ) : void => {
1919 for ( const [ key , value ] of Object . entries ( newDef ) ) {
2020 codeHolder [ key ] = value ;
2121 versions [ key ] = ( versions [ key ] ?? 1 ) + 1 ;
@@ -54,7 +54,13 @@ 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 ( ) ;
6066 let type = 'any' ;
@@ -79,7 +85,7 @@ export default class Autocompleter {
7985 [ this . languageService , this . updateCode ] = getVirtualLanguageService ( ) ;
8086 }
8187
82- autocomplete ( code : string , position ?: number ) {
88+ autocomplete ( code : string , position ?: number ) : AutoCompletion [ ] {
8389 if ( typeof position === 'undefined' ) {
8490 position = code . length ;
8591 }
You can’t perform that action at this time.
0 commit comments