Commit 6eb7fbc0 authored by rockyl's avatar rockyl

修复负数没有默认值的问题

parent 23c636b8
...@@ -190,12 +190,12 @@ function addProp(dataContainer, name, valueDeclaration, checker) { ...@@ -190,12 +190,12 @@ function addProp(dataContainer, name, valueDeclaration, checker) {
} else if (initializer.arguments) { } else if (initializer.arguments) {
defaultValue = []; defaultValue = [];
for (let argument of initializer.arguments) { for (let argument of initializer.arguments) {
let typeDef = checker.getTypeAtLocation(argument);
let value = argument.text || (argument.name && argument.name.escapedText); let value = argument.text || (argument.name && argument.name.escapedText);
defaultValue.push(value); defaultValue.push(value);
} }
} else { } else if(typeName === 'number'){
defaultValue = initializer && (initializer.text ? parseFloat(initializer.text) : (initializer.operand ? -parseFloat(initializer.operand.text) : undefined))
}else{
defaultValue = initializer && (initializer.text || (initializer.name && initializer.name.escapedText)); defaultValue = initializer && (initializer.text || (initializer.name && initializer.name.escapedText));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment