Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codefix for implementing interfaces #11547

Merged
merged 101 commits into from
Dec 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
1438f9a
Codefixes for implement interface and change extends to implements.
Oct 11, 2016
7a5cb5f
Merge branch 'pvb/codeaction/api' into interfaceFixes
Oct 12, 2016
bf3e487
Merge branch 'master' into interfaceFixes
Oct 13, 2016
6b4f6b5
Remove Type Assignability QuickFix
aozgaa Oct 25, 2016
151f940
Refactor classDeclarations
aozgaa Oct 25, 2016
d1cea73
Refactor Loop
aozgaa Oct 25, 2016
c2feab6
Rename Tests
aozgaa Oct 25, 2016
f74872d
temp
aozgaa Oct 26, 2016
2abf906
Merge branch 'master' into interfaceFixes
aozgaa Oct 26, 2016
132b746
Covnert to Doc Comment
aozgaa Oct 26, 2016
ecc029f
more temp
aozgaa Oct 26, 2016
a66b0ae
Split CodeFixes in Separate Files
aozgaa Oct 26, 2016
5d9a4e3
Move codeFixProvider.ts
aozgaa Oct 27, 2016
3ac9ffa
Nerf Extends to implements For Now
aozgaa Oct 27, 2016
d24236b
Simplify getCodeFixChanges
aozgaa Oct 27, 2016
7758e6d
Rename Most Tests
aozgaa Oct 28, 2016
7272833
Rename and Add a Test
aozgaa Oct 28, 2016
834245c
Add Failing Tests
aozgaa Oct 28, 2016
c89b97b
Add removeAbstractModifier Fix
aozgaa Oct 29, 2016
16dc834
extends->implements w/ implements keyword present
aozgaa Oct 29, 2016
cbaea99
Cleanup Extends -> Interface Change
aozgaa Oct 31, 2016
bc21346
Refactor fourslash testing for codeFixes
aozgaa Nov 1, 2016
99ae5d9
Remove unused tests
aozgaa Nov 1, 2016
aa6ecd4
Fix linting errors
aozgaa Nov 1, 2016
3240000
Merge branch 'master' into interfaceFixes
aozgaa Nov 1, 2016
0380f3f
Recognize modifiers
aozgaa Nov 2, 2016
1b60a97
Remove unused
aozgaa Nov 2, 2016
e5279fd
Rename and simplify fourslash interface
aozgaa Nov 2, 2016
04968ab
fix references to codefixes?
aozgaa Nov 2, 2016
d02eb6c
fix jakefile1
aozgaa Nov 2, 2016
3b0b696
broken
aozgaa Nov 3, 2016
36c5bef
Add tests and simplify existing ones
aozgaa Nov 4, 2016
1b8486d
Still re-writing missing member grabber
aozgaa Nov 4, 2016
b7b30aa
Add straggling Test
aozgaa Nov 4, 2016
71d1744
Test Fixes
aozgaa Nov 8, 2016
8c35185
Expose More TypeChecker
aozgaa Nov 8, 2016
bc1bb0e
Make test failure more readable
aozgaa Nov 8, 2016
0ce53f0
rename tests
aozgaa Nov 8, 2016
b26ba83
Expose signatureToString, addSupressAnyReturn Flag
aozgaa Nov 8, 2016
11cea6a
Use TypeChecker to Get Types, Print
aozgaa Nov 8, 2016
7141a2a
Better error message in fourslash
aozgaa Nov 8, 2016
55bf3e3
Use new engine for interface fixes
aozgaa Nov 8, 2016
4441380
tests: edit expected type params
aozgaa Nov 8, 2016
1ec234a
Edit error handling tests
aozgaa Nov 8, 2016
6bd35fb
Fix Type Param method Tests
aozgaa Nov 8, 2016
4973852
fix linter errors
aozgaa Nov 8, 2016
1d6ef6a
cleanup
aozgaa Nov 9, 2016
d842a6f
Merge branch 'master' into interfaceFixes
aozgaa Nov 9, 2016
b1e97b3
Get one fix per interface
aozgaa Nov 10, 2016
c650c33
Update tests
aozgaa Nov 10, 2016
0591e1b
Simplify Testing
aozgaa Nov 10, 2016
263734f
Add a test
aozgaa Nov 14, 2016
4b202ab
Initialize result to empy array
aozgaa Nov 14, 2016
357ed7e
Remove Inner Loop
aozgaa Nov 14, 2016
f6fc320
Get Ancestor instead of manual walk
aozgaa Nov 14, 2016
efd16c7
Spell out names fully
aozgaa Nov 14, 2016
bba96da
remove multiple implements TODO
aozgaa Nov 14, 2016
cfe50d1
Fix extends -> implements for decorators/modifiers
aozgaa Nov 14, 2016
ad3035d
remove generated file from PR
aozgaa Nov 14, 2016
d8b359f
Fix typo and capitalization
aozgaa Nov 14, 2016
6400d53
Fix handling of default class
aozgaa Nov 14, 2016
c010a0e
Use getTypeOfSymbolAtLocation
aozgaa Nov 15, 2016
395d736
Remove getSymbolOfNode from TypeChecker interface
aozgaa Nov 15, 2016
d7d4bf6
Handle class expressions
aozgaa Nov 15, 2016
a94d955
Aggregate changes before building result
aozgaa Nov 15, 2016
43afb80
remove fix
aozgaa Nov 15, 2016
6ed8d18
unexpose resolveStructuredTypeMembers
aozgaa Nov 15, 2016
389959a
Merge branch 'master' into interfaceFixes
aozgaa Nov 15, 2016
69118cd
Merge branch 'master' into interfaceFixes
Nov 17, 2016
4af0e2a
Merge branch 'master' into interfaceFixes
Nov 28, 2016
680af0f
use getStart()
Nov 28, 2016
16b146f
Use array instead of map
Nov 28, 2016
f37640a
Add args to diagnostic message
Nov 28, 2016
5d6a714
move helpers under codefix dir
Nov 28, 2016
bf48564
FIx typo in method stub.
Nov 29, 2016
ba80ce6
stubbing extra completions
Nov 29, 2016
8134d64
Merge branch 'master' into interfaceFixes
Dec 5, 2016
0c1772b
Merge branch 'interfaceFixes' of https://github.com/Microsoft/TypeScr…
Dec 5, 2016
f0c7713
implement getters/setters as property
Dec 5, 2016
c511aea
Add Support for multiple signatures
Dec 7, 2016
5cd0ea3
handle well-known computed property/method names
Dec 8, 2016
c22e47d
add test for computed literals
Dec 8, 2016
c1a41b9
Expose indexSignaturePrinting
Dec 8, 2016
2f51b36
add missing index signature support
Dec 9, 2016
97b3d7a
make index signature fix work with generics
Dec 9, 2016
819a654
Add tests and fix rest parameters
Dec 9, 2016
5e48e33
cleanup
Dec 9, 2016
1338b94
Simplify rest parameter handling
Dec 9, 2016
b9ae36c
Simplify index signature generation
Dec 9, 2016
d724517
Merge branch 'master' into interfaceFixes
Dec 9, 2016
469745b
Synthetic signature uses existing parameter names
Dec 12, 2016
1ba6c86
Merge branch 'master' into interfaceFixes
Dec 12, 2016
ad01110
Consolidate Tests
Dec 12, 2016
3cfac08
abstract class expr instantiation and abstract fix works with class expr
Dec 14, 2016
4673812
refactor fix
Dec 14, 2016
4b02099
add tests
Dec 14, 2016
8be8819
simplify and inline methods
Dec 14, 2016
d75d548
implicit any for synthesized signature
Dec 14, 2016
4af3937
Merge branch 'master' into interfaceFixes
Dec 14, 2016
97f18c9
Cleanup
Dec 14, 2016
3fc94bb
Rename Tests
Dec 14, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ var servicesSources = [
"signatureHelp.ts",
"symbolDisplay.ts",
"transpile.ts",
// Formatting
"formatting/formatting.ts",
"formatting/formattingContext.ts",
"formatting/formattingRequestKind.ts",
Expand All @@ -166,7 +167,18 @@ var servicesSources = [
"formatting/rulesMap.ts",
"formatting/rulesProvider.ts",
"formatting/smartIndenter.ts",
"formatting/tokenRange.ts"
"formatting/tokenRange.ts",
// CodeFixes
"codeFixProvider.ts",
"codefixes/fixes.ts",
"codefixes/fixExtendsInterfaceBecomesImplements.ts",
"codefixes/fixClassIncorrectlyImplementsInterface.ts",
"codefixes/fixClassDoesntImplementInheritedAbstractMember.ts",
"codefixes/fixClassSuperMustPrecedeThisAccess.ts",
"codefixes/fixConstructorForDerivedNeedSuperCall.ts",
"codefixes/helpers.ts",
"codefixes/importFixes.ts",
"codefixes/unusedIdentifierFixes.ts"
].map(function (f) {
return path.join(servicesDirectory, f);
}));
Expand Down
95 changes: 60 additions & 35 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ namespace ts {
getDeclaredTypeOfSymbol,
getPropertiesOfType,
getPropertyOfType,
getIndexInfoOfType,
getSignaturesOfType,
getIndexTypeOfType,
getBaseTypes,
getTypeFromTypeNode,
getReturnTypeOfSignature,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is not used i would remove it for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

getNonNullableType,
getSymbolsInScope,
Expand All @@ -90,6 +92,7 @@ namespace ts {
getExportSpecifierLocalTargetSymbol,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would say use new Symbol() here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

getTypeAtLocation: getTypeOfNode,
getPropertySymbolOfDestructuringAssignment,
signatureToString,
typeToString,
getSymbolDisplayBuilder,
symbolToString,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider inlining these two using checker.getSymbolDisplayBuilder().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signatureToString is needed independently in the checker anyways, so I'd prefer to avoid copying the code if it can be avoided.

indexSignatureToString: Only used in one place in the current PR, but we may find it useful in a future codefix for adding index signatures. Will inline for now, but may have to re-declare it in the future.

Expand Down Expand Up @@ -1344,7 +1347,9 @@ namespace ts {
return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol);
}

// Resolves a qualified name and any involved aliases
/**
* Resolves a qualified name and any involved aliases.
*/
function resolveEntityName(name: EntityNameOrEntityNameExpression, meaning: SymbolFlags, ignoreErrors?: boolean, dontResolveAlias?: boolean, location?: Node): Symbol | undefined {
if (nodeIsMissing(name)) {
return undefined;
Expand Down Expand Up @@ -2085,7 +2090,7 @@ namespace ts {
return result || types;
}

function visibilityToString(flags: ModifierFlags) {
function visibilityToString(flags: ModifierFlags): string | undefined {
if (flags === ModifierFlags.Private) {
return "private";
}
Expand Down Expand Up @@ -2463,26 +2468,6 @@ namespace ts {
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Value, SymbolFormatFlags.None, typeFormatFlags);
}

function writeIndexSignature(info: IndexInfo, keyword: SyntaxKind) {
if (info) {
if (info.isReadonly) {
writeKeyword(writer, SyntaxKind.ReadonlyKeyword);
writeSpace(writer);
}
writePunctuation(writer, SyntaxKind.OpenBracketToken);
writer.writeParameter(info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : "x");
writePunctuation(writer, SyntaxKind.ColonToken);
writeSpace(writer);
writeKeyword(writer, keyword);
writePunctuation(writer, SyntaxKind.CloseBracketToken);
writePunctuation(writer, SyntaxKind.ColonToken);
writeSpace(writer);
writeType(info.type, TypeFormatFlags.None);
writePunctuation(writer, SyntaxKind.SemicolonToken);
writer.writeLine();
}
}

function writePropertyWithModifiers(prop: Symbol) {
if (isReadonlySymbol(prop)) {
writeKeyword(writer, SyntaxKind.ReadonlyKeyword);
Expand Down Expand Up @@ -2570,8 +2555,8 @@ namespace ts {
writePunctuation(writer, SyntaxKind.SemicolonToken);
writer.writeLine();
}
writeIndexSignature(resolved.stringIndexInfo, SyntaxKind.StringKeyword);
writeIndexSignature(resolved.numberIndexInfo, SyntaxKind.NumberKeyword);
buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, IndexKind.String, enclosingDeclaration, globalFlags, symbolStack);
buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, IndexKind.Number, enclosingDeclaration, globalFlags, symbolStack);
for (const p of resolved.properties) {
const t = getTypeOfSymbol(p);
if (p.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfObjectType(t).length) {
Expand Down Expand Up @@ -2762,6 +2747,11 @@ namespace ts {
}

function buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) {
const returnType = getReturnTypeOfSignature(signature);
if (flags & TypeFormatFlags.SuppressAnyReturnType && isTypeAny(returnType)) {
return;
}

if (flags & TypeFormatFlags.WriteArrowStyleSignature) {
writeSpace(writer);
writePunctuation(writer, SyntaxKind.EqualsGreaterThanToken);
Expand All @@ -2775,7 +2765,6 @@ namespace ts {
buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack);
}
else {
const returnType = getReturnTypeOfSignature(signature);
buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack);
}
}
Expand All @@ -2800,6 +2789,34 @@ namespace ts {
buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack);
}

function buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]) {
if (info) {
if (info.isReadonly) {
writeKeyword(writer, SyntaxKind.ReadonlyKeyword);
writeSpace(writer);
}
writePunctuation(writer, SyntaxKind.OpenBracketToken);
writer.writeParameter(info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : "x");
writePunctuation(writer, SyntaxKind.ColonToken);
writeSpace(writer);
switch (kind) {
case IndexKind.Number:
writeKeyword(writer, SyntaxKind.NumberKeyword);
break;
case IndexKind.String:
writeKeyword(writer, SyntaxKind.StringKeyword);
break;
}

writePunctuation(writer, SyntaxKind.CloseBracketToken);
writePunctuation(writer, SyntaxKind.ColonToken);
writeSpace(writer);
buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack);
writePunctuation(writer, SyntaxKind.SemicolonToken);
writer.writeLine();
}
}

return _displayBuilder || (_displayBuilder = {
buildSymbolDisplay,
buildTypeDisplay,
Expand All @@ -2810,6 +2827,7 @@ namespace ts {
buildDisplayForTypeParametersAndDelimiters,
buildTypeParameterDisplayFromSymbol,
buildSignatureDisplay,
buildIndexSignatureDisplay,
buildReturnTypeDisplay
});
}
Expand Down Expand Up @@ -3765,11 +3783,13 @@ namespace ts {
return signatures;
}

// The base constructor of a class can resolve to
// undefinedType if the class has no extends clause,
// unknownType if an error occurred during resolution of the extends expression,
// nullType if the extends expression is the null value, or
// an object type with at least one construct signature.
/**
* The base constructor of a class can resolve to
* * undefinedType if the class has no extends clause,
* * unknownType if an error occurred during resolution of the extends expression,
* * nullType if the extends expression is the null value, or
* * an object type with at least one construct signature.
*/
function getBaseConstructorTypeOfClass(type: InterfaceType): Type {
if (!type.resolvedBaseConstructorType) {
const baseTypeNode = getBaseTypeNodeOfClass(type);
Expand Down Expand Up @@ -4250,7 +4270,7 @@ namespace ts {
return <InterfaceTypeWithDeclaredMembers>type;
}

function getTypeWithThisArgument(type: Type, thisArgument?: Type) {
function getTypeWithThisArgument(type: Type, thisArgument?: Type): Type {
if (getObjectFlags(type) & ObjectFlags.Reference) {
return createTypeReference((<TypeReference>type).target,
concatenate((<TypeReference>type).typeArguments, [thisArgument || (<TypeReference>type).target.thisType]));
Expand Down Expand Up @@ -4476,6 +4496,9 @@ namespace ts {
setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);
}

/**
* Converts an AnonymousType to a ResolvedType.
*/
function resolveAnonymousTypeMembers(type: AnonymousType) {
const symbol = type.symbol;
if (type.target) {
Expand Down Expand Up @@ -7238,10 +7261,12 @@ namespace ts {
return false;
}

// Compare two types and return
// Ternary.True if they are related with no assumptions,
// Ternary.Maybe if they are related with assumptions of other relationships, or
// Ternary.False if they are not related.
/**
* Compare two types and return
* * Ternary.True if they are related with no assumptions,
* * Ternary.Maybe if they are related with assumptions of other relationships, or
* * Ternary.False if they are not related.
*/
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): Ternary {
let result: Ternary;
if (source.flags & TypeFlags.StringOrNumberLiteral && source.flags & TypeFlags.FreshLiteral) {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ namespace ts {
}
}

function formatStringFromArgs(text: string, args: { [index: number]: string; }, baseIndex?: number): string {
export function formatStringFromArgs(text: string, args: { [index: number]: string; }, baseIndex?: number): string {
baseIndex = baseIndex || 0;

return text.replace(/{(\d+)}/g, (_match, index?) => args[+index + baseIndex]);
Expand Down
12 changes: 4 additions & 8 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3195,23 +3195,19 @@
"category": "Message",
"code": 90002
},
"Change 'extends' to 'implements'": {
"Change 'extends' to 'implements'.": {
"category": "Message",
"code": 90003
},
"Remove unused identifiers": {
"Remove unused identifiers.": {
"category": "Message",
"code": 90004
},
"Implement interface on reference": {
"category": "Message",
"code": 90005
},
"Implement interface on class": {
"Implement interface '{0}'.": {
"category": "Message",
"code": 90006
},
"Implement inherited abstract class": {
"Implement inherited abstract class.": {
"category": "Message",
"code": 90007
},
Expand Down
33 changes: 20 additions & 13 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,9 @@ namespace ts {

export interface ParameterDeclaration extends Declaration {
kind: SyntaxKind.Parameter;
dotDotDotToken?: DotDotDotToken; // Present on rest parameter
dotDotDotToken?: DotDotDotToken; // Present on rest parameter
name: BindingName; // Declared parameter name
questionToken?: QuestionToken; // Present on optional parameter
questionToken?: QuestionToken; // Present on optional parameter
type?: TypeNode; // Optional type annotation
initializer?: Expression; // Optional initializer
}
Expand All @@ -658,14 +658,14 @@ namespace ts {
export interface PropertySignature extends TypeElement {
kind: SyntaxKind.PropertySignature | SyntaxKind.JSDocRecordMember;
name: PropertyName; // Declared property name
questionToken?: QuestionToken; // Present on optional property
questionToken?: QuestionToken; // Present on optional property
type?: TypeNode; // Optional type annotation
initializer?: Expression; // Optional initializer
}

export interface PropertyDeclaration extends ClassElement {
kind: SyntaxKind.PropertyDeclaration;
questionToken?: QuestionToken; // Present for use with reporting a grammar error
questionToken?: QuestionToken; // Present for use with reporting a grammar error
name: PropertyName;
type?: TypeNode;
initializer?: Expression; // Optional initializer
Expand Down Expand Up @@ -2335,6 +2335,7 @@ namespace ts {
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
getPropertiesOfType(type: Type): Symbol[];
getPropertyOfType(type: Type, propertyName: string): Symbol;
getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo;
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
getBaseTypes(type: InterfaceType): ObjectType[];
Expand All @@ -2348,6 +2349,8 @@ namespace ts {
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;
signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
getSymbolDisplayBuilder(): SymbolDisplayBuilder;
Expand Down Expand Up @@ -2391,6 +2394,7 @@ namespace ts {
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void;
buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
Expand Down Expand Up @@ -2434,6 +2438,7 @@ namespace ts {
InFirstTypeArgument = 0x00000100, // Writing first type argument of the instantiated type
InTypeAlias = 0x00000200, // Writing type in type alias declaration
UseTypeAliasValue = 0x00000400, // Serialize the type instead of using type-alias. This is needed when we emit declaration file.
SuppressAnyReturnType = 0x00000800, // If the return type is any-like, don't offer a return type.
}

export const enum SymbolFormatFlags {
Expand Down Expand Up @@ -2865,7 +2870,7 @@ namespace ts {
objectFlags: ObjectFlags;
}

// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
/** Class and interface types (TypeFlags.Class and TypeFlags.Interface). */
export interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none)
Expand All @@ -2885,14 +2890,16 @@ namespace ts {
declaredNumberIndexInfo: IndexInfo; // Declared numeric indexing info
}

// Type references (TypeFlags.Reference). When a class or interface has type parameters or
// a "this" type, references to the class or interface are made using type references. The
// typeArguments property specifies the types to substitute for the type parameters of the
// class or interface and optionally includes an extra element that specifies the type to
// substitute for "this" in the resulting instantiation. When no extra argument is present,
// the type reference itself is substituted for "this". The typeArguments property is undefined
// if the class or interface has no type parameters and the reference isn't specifying an
// explicit "this" argument.
/**
* Type references (TypeFlags.Reference). When a class or interface has type parameters or
* a "this" type, references to the class or interface are made using type references. The
* typeArguments property specifies the types to substitute for the type parameters of the
* class or interface and optionally includes an extra element that specifies the type to
* substitute for "this" in the resulting instantiation. When no extra argument is present,
* the type reference itself is substituted for "this". The typeArguments property is undefined
* if the class or interface has no type parameters and the reference isn't specifying an
* explicit "this" argument.
*/
export interface TypeReference extends ObjectType {
target: GenericType; // Type reference target
typeArguments: Type[]; // Type reference type arguments (undefined if none)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ namespace ts {
}
}

export function getAncestor(node: Node, kind: SyntaxKind): Node {
export function getAncestor(node: Node | undefined, kind: SyntaxKind): Node {
while (node) {
if (node.kind === kind) {
return node;
Expand Down
Loading