All variables and parameters have type undefined(JS)
mundusnine opened this issue · 1 comments
mundusnine commented
I have a js script.
In it I have this function:
getMore(a,b=32){
var test = 1
return a+b+test;
};
In this instance the "test" var is assigned a "int" and "b" also but when parsed only outputs type: undefined i.e.:
getMore
[ VariableDeclaration {
name: 'test',
isConst: false,
isExported: false,
type: undefined,
start: 394,
end: 406 } ]
The type of the function also returns undefined. Is this normal behavior or is this an issue with the parser or the typescript compiler ?
buehler commented
Hey @mundusnine
Actually this package does not type infer. This package aims to give information about the current code and therefore it's working as designed. Since you don't have a type information in the code, the parser cannot give you information about it.
if you would have:
getMore(a, b: number = 32) /*...*/
it would give you "type: number"