@fimbul/mimir
Advanced tools
Comparing version 0.16.0-dev.20181031 to 0.16.0-dev.20181104
{ | ||
"name": "@fimbul/mimir", | ||
"version": "0.16.0-dev.20181031", | ||
"version": "0.16.0-dev.20181104", | ||
"description": "Core rules of the Fimbullinter project", | ||
@@ -5,0 +5,0 @@ "main": "recommended.yaml", |
@@ -78,4 +78,3 @@ "use strict"; | ||
getPropertyInfoFromSpread(node) { | ||
const type = this.checker.getTypeAtLocation(node); | ||
return tsutils_1.unionTypeParts(type).map(getPropertyInfoFromType).reduce(unionPropertyInfo); | ||
return getPropertyInfoFromType(this.checker.getTypeAtLocation(node)); | ||
} | ||
@@ -89,9 +88,16 @@ }; | ||
function getPropertyInfoFromType(type) { | ||
if (tsutils_1.isUnionType(type)) | ||
return type.types.map(getPropertyInfoFromType).reduce(unionPropertyInfo); | ||
if (tsutils_1.isIntersectionType(type)) | ||
return type.types.map(getPropertyInfoFromType).reduce(intersectPropertyInfo); | ||
if (type.flags & ts.TypeFlags.Instantiable) { | ||
const constraint = type.getConstraint(); | ||
if (constraint === undefined) | ||
return emptyPropertyInfo; | ||
return Object.assign({}, getPropertyInfoFromType(constraint), { known: false }); | ||
} | ||
if (!tsutils_1.isObjectType(type)) | ||
return emptyPropertyInfo; | ||
const result = { | ||
known: (type.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) !== 0 || | ||
type.getStringIndexType() === undefined && type.getNumberIndexType() === undefined, | ||
known: type.getStringIndexType() === undefined && type.getNumberIndexType() === undefined, | ||
names: [], | ||
@@ -98,0 +104,0 @@ assignedNames: [], |
Sorry, the diff of this file is not supported yet
422858
4240