babel-plugin-exercize icon indicating copy to clipboard operation
babel-plugin-exercize copied to clipboard

exercise-type-checker, 发现bug

Open Hercules11 opened this issue 1 year ago • 0 comments

exercize-type-checker/src/type-checker-entry3.js

function resolveType(targetType) {
	const tsTypeAnnotationMap = {
		TSStringKeyword: "string",
		TSNumberKeyword: "number",
	};
	switch (targetType.type) {
		case "TSTypeAnnotation":
            return tsTypeAnnotationMap[targetType.typeAnnotation.type]; // 失效了, 调试发现targetType对象没有TSTypeAnnotation属性
		case "NumberTypeAnnotation":
			return "number";
		case "StringTypeAnnotation":
			return "string";
	}
}

Hercules11 avatar Dec 17 '23 06:12 Hercules11