temp
This commit is contained in:
parent
8020e24fda
commit
758e1ff8b7
3 changed files with 4 additions and 11 deletions
|
@ -2293,25 +2293,18 @@ namespace ts {
|
|||
}
|
||||
if (objectFlags & ObjectFlags.ClassOrInterface) {
|
||||
Debug.assert(!!(type.flags & TypeFlags.Object));
|
||||
// TODO: Detect whether class is named and fail if not.
|
||||
const name = getNameOfSymbol(type.symbol);
|
||||
// TODO: handle type arguments.
|
||||
// TODO: handle anonymous classes.
|
||||
return createTypeReferenceNode(name, /*typeParameters*/undefined);
|
||||
}
|
||||
if (type.flags & TypeFlags.TypeParameter) {
|
||||
const constraint = createTypeNode(getConstraintFromTypeParameter(<TypeParameter>type)) as TypeNode;
|
||||
const defaultParameter = createTypeNode(getDefaultFromTypeParameter(<TypeParameter>type)) as TypeNode;
|
||||
if(constraint || defaultParameter) {
|
||||
// Type parameters in type position can't have constraints or defaults.
|
||||
encounteredError = true;
|
||||
return undefined;
|
||||
}
|
||||
// TODO: get qualified name when necessary instead of string.
|
||||
const name = symbolToString(type.symbol);
|
||||
// Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter.
|
||||
return createTypeReferenceNode(name, /*typeArguments*/ undefined);
|
||||
}
|
||||
|
||||
// accessible type aliasSymbol
|
||||
// TODO: move back up later on?
|
||||
if (checkAlias && type.aliasSymbol) {
|
||||
const name = getNameOfSymbol(type.aliasSymbol);
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace ts.codefix {
|
|||
|
||||
function createParameterDeclarationFromSymbol(parameterSymbol: Symbol, enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker) {
|
||||
const parameterDeclaration = parameterSymbol.getDeclarations()[0] as ParameterDeclaration;
|
||||
const parameterType = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(parameterSymbol, enclosingDeclaration));
|
||||
const parameterType = checker.getTypeOfSymbolAtLocation(parameterSymbol, enclosingDeclaration);
|
||||
const parameterTypeNode = checker.createTypeNode(parameterType);
|
||||
// TODO: deep cloning of decorators/any node.
|
||||
const parameterNode = createParameter(
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
verify.rangeAfterCodeFix(`
|
||||
class A {
|
||||
[name: string]: number;
|
||||
[x: string]: number;
|
||||
|
||||
constructor() {
|
||||
this.x = 10;
|
||||
|
|
Loading…
Reference in a new issue