From a54dd69720bea7319ac87a36eaac0ca647bff4c6 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 20 Nov 2021 16:41:23 -0500 Subject: [PATCH] feat: make `Structure.isX` function more flexible Closes #1219 --- deno/ts_morph.d.ts | 308 +++++------------ deno/ts_morph.js | 231 ++++++++----- packages/ts-morph/lib/ts-morph.d.ts | 308 +++++------------ .../generation/createStructureTypeGuards.ts | 12 +- .../{Structure.ts => Structure.generated.ts} | 316 +++++++++--------- .../class/ClassDeclarationStructure.ts | 2 +- .../ClassStaticBlockDeclarationStructure.ts | 2 +- .../class/ConstructorDeclarationStructure.ts | 2 +- .../class/GetAccessorDeclarationStructure.ts | 2 +- .../class/MethodDeclarationStructure.ts | 2 +- .../class/PropertyDeclarationStructure.ts | 2 +- .../class/SetAccessorDeclarationStructure.ts | 2 +- .../decorator/DecoratorStructure.ts | 2 +- .../src/structures/doc/JSDocStructure.ts | 2 +- .../src/structures/doc/JSDocTagStructure.ts | 2 +- .../enum/EnumDeclarationStructure.ts | 2 +- .../structures/enum/EnumMemberStructure.ts | 2 +- .../object/PropertyAssignmentStructure.ts | 2 +- .../ShorthandPropertyAssignmentStructure.ts | 2 +- .../object/SpreadAssignmentStructure.ts | 2 +- .../function/FunctionDeclarationStructure.ts | 2 +- .../function/ParameterDeclarationStructure.ts | 2 +- packages/ts-morph/src/structures/index.ts | 2 +- .../CallSignatureDeclarationStructure.ts | 2 +- .../ConstructSignatureDeclarationStructure.ts | 2 +- .../IndexSignatureDeclarationStructure.ts | 2 +- .../InterfaceDeclarationStructure.ts | 2 +- .../interface/MethodSignatureStructure.ts | 2 +- .../interface/PropertySignatureStructure.ts | 2 +- .../structures/jsx/JsxAttributeStructure.ts | 2 +- .../src/structures/jsx/JsxElementStructure.ts | 2 +- .../jsx/JsxSelfClosingElementStructure.ts | 2 +- .../jsx/JsxSpreadAttributeStructure.ts | 2 +- .../structures/module/AssertEntryStructure.ts | 2 +- .../module/ExportAssignmentStructure.ts | 2 +- .../module/ExportDeclarationStructure.ts | 2 +- .../module/ExportSpecifierStructure.ts | 2 +- .../module/ImportDeclarationStructure.ts | 2 +- .../module/ImportSpecifierStructure.ts | 2 +- .../module/ModuleDeclarationStructure.ts | 2 +- .../structures/module/SourceFileStructure.ts | 2 +- .../statement/VariableDeclarationStructure.ts | 2 +- .../statement/VariableStatementStructure.ts | 2 +- .../type/TypeAliasDeclarationStructure.ts | 2 +- .../type/TypeParameterDeclarationStructure.ts | 2 +- 45 files changed, 510 insertions(+), 745 deletions(-) rename packages/ts-morph/src/structures/{Structure.ts => Structure.generated.ts} (57%) diff --git a/deno/ts_morph.d.ts b/deno/ts_morph.d.ts index 776b4fef1..661528a23 100644 --- a/deno/ts_morph.d.ts +++ b/deno/ts_morph.d.ts @@ -10687,313 +10687,159 @@ export declare const Structure: { name: string; }; /** Gets if the provided structure is a AssertEntryStructure. */ - readonly isAssertEntry: (structure: Structure & { - kind: StructureKind; - }) => structure is AssertEntryStructure; + readonly isAssertEntry: (structure: unknown) => structure is AssertEntryStructure; /** Gets if the provided structure is a AssertionKeyNamedNodeStructure. */ - readonly isAssertionKeyNamed: (structure: T_1) => structure is T_1 & AssertionKeyNamedNodeStructure; + readonly isAssertionKeyNamed: (structure: T_1) => structure is T_1 & AssertionKeyNamedNodeStructure; /** Gets if the provided structure is a CallSignatureDeclarationStructure. */ - readonly isCallSignature: (structure: Structure & { - kind: StructureKind; - }) => structure is CallSignatureDeclarationStructure; + readonly isCallSignature: (structure: unknown) => structure is CallSignatureDeclarationStructure; /** Gets if the provided structure is a JSDocableNodeStructure. */ - readonly isJSDocable: (structure: T_2) => structure is T_2 & JSDocableNodeStructure; + readonly isJSDocable: (structure: T_2) => structure is T_2 & JSDocableNodeStructure; /** Gets if the provided structure is a SignaturedDeclarationStructure. */ - readonly isSignatured: (structure: T_3) => structure is T_3 & SignaturedDeclarationStructure; + readonly isSignatured: (structure: T_3) => structure is T_3 & SignaturedDeclarationStructure; /** Gets if the provided structure is a ParameteredNodeStructure. */ - readonly isParametered: (structure: T_4) => structure is T_4 & ParameteredNodeStructure; + readonly isParametered: (structure: T_4) => structure is T_4 & ParameteredNodeStructure; /** Gets if the provided structure is a ReturnTypedNodeStructure. */ - readonly isReturnTyped: (structure: T_5) => structure is T_5 & ReturnTypedNodeStructure; + readonly isReturnTyped: (structure: T_5) => structure is T_5 & ReturnTypedNodeStructure; /** Gets if the provided structure is a TypeParameteredNodeStructure. */ - readonly isTypeParametered: (structure: T_6) => structure is T_6 & TypeParameteredNodeStructure; + readonly isTypeParametered: (structure: T_6) => structure is T_6 & TypeParameteredNodeStructure; /** Gets if the provided structure is a ClassDeclarationStructure. */ - readonly isClass: (structure: Structure & { - kind: StructureKind; - }) => structure is ClassDeclarationStructure; + readonly isClass: (structure: unknown) => structure is ClassDeclarationStructure; /** Gets if the provided structure is a ClassLikeDeclarationBaseStructure. */ - readonly isClassLikeDeclarationBase: (structure: T_7) => structure is T_7 & ClassLikeDeclarationBaseStructure; + readonly isClassLikeDeclarationBase: (structure: T_7) => structure is T_7 & ClassLikeDeclarationBaseStructure; /** Gets if the provided structure is a NameableNodeStructure. */ - readonly isNameable: (structure: T_8) => structure is T_8 & NameableNodeStructure; + readonly isNameable: (structure: T_8) => structure is T_8 & NameableNodeStructure; /** Gets if the provided structure is a ImplementsClauseableNodeStructure. */ - readonly isImplementsClauseable: (structure: T_9) => structure is T_9 & ImplementsClauseableNodeStructure; + readonly isImplementsClauseable: (structure: T_9) => structure is T_9 & ImplementsClauseableNodeStructure; /** Gets if the provided structure is a DecoratableNodeStructure. */ - readonly isDecoratable: (structure: T_10) => structure is T_10 & DecoratableNodeStructure; + readonly isDecoratable: (structure: T_10) => structure is T_10 & DecoratableNodeStructure; /** Gets if the provided structure is a AbstractableNodeStructure. */ - readonly isAbstractable: (structure: T_11) => structure is T_11 & AbstractableNodeStructure; + readonly isAbstractable: (structure: T_11) => structure is T_11 & AbstractableNodeStructure; /** Gets if the provided structure is a AmbientableNodeStructure. */ - readonly isAmbientable: (structure: T_12) => structure is T_12 & AmbientableNodeStructure; + readonly isAmbientable: (structure: T_12) => structure is T_12 & AmbientableNodeStructure; /** Gets if the provided structure is a ExportableNodeStructure. */ - readonly isExportable: (structure: T_13) => structure is T_13 & ExportableNodeStructure; + readonly isExportable: (structure: T_13) => structure is T_13 & ExportableNodeStructure; /** Gets if the provided structure is a ClassStaticBlockDeclarationStructure. */ - readonly isClassStaticBlock: (structure: Structure & { - kind: StructureKind; - }) => structure is ClassStaticBlockDeclarationStructure; + readonly isClassStaticBlock: (structure: unknown) => structure is ClassStaticBlockDeclarationStructure; /** Gets if the provided structure is a StatementedNodeStructure. */ - readonly isStatemented: (structure: T_14) => structure is T_14 & StatementedNodeStructure; + readonly isStatemented: (structure: T_14) => structure is T_14 & StatementedNodeStructure; /** Gets if the provided structure is a ConstructorDeclarationOverloadStructure. */ - readonly isConstructorDeclarationOverload: (structure: Structure & { - kind: StructureKind; - }) => structure is ConstructorDeclarationOverloadStructure; + readonly isConstructorDeclarationOverload: (structure: unknown) => structure is ConstructorDeclarationOverloadStructure; /** Gets if the provided structure is a ScopedNodeStructure. */ - readonly isScoped: (structure: T_15) => structure is T_15 & ScopedNodeStructure; + readonly isScoped: (structure: T_15) => structure is T_15 & ScopedNodeStructure; /** Gets if the provided structure is a ConstructorDeclarationStructure. */ - readonly isConstructor: (structure: Structure & { - kind: StructureKind; - }) => structure is ConstructorDeclarationStructure; + readonly isConstructor: (structure: unknown) => structure is ConstructorDeclarationStructure; /** Gets if the provided structure is a FunctionLikeDeclarationStructure. */ - readonly isFunctionLike: (structure: T_16) => structure is T_16 & FunctionLikeDeclarationStructure; + readonly isFunctionLike: (structure: T_16) => structure is T_16 & FunctionLikeDeclarationStructure; /** Gets if the provided structure is a ConstructSignatureDeclarationStructure. */ - readonly isConstructSignature: (structure: Structure & { - kind: StructureKind; - }) => structure is ConstructSignatureDeclarationStructure; + readonly isConstructSignature: (structure: unknown) => structure is ConstructSignatureDeclarationStructure; /** Gets if the provided structure is a DecoratorStructure. */ - readonly isDecorator: (structure: Structure & { - kind: StructureKind; - }) => structure is DecoratorStructure; + readonly isDecorator: (structure: unknown) => structure is DecoratorStructure; /** Gets if the provided structure is a EnumDeclarationStructure. */ - readonly isEnum: (structure: Structure & { - kind: StructureKind; - }) => structure is EnumDeclarationStructure; + readonly isEnum: (structure: unknown) => structure is EnumDeclarationStructure; /** Gets if the provided structure is a NamedNodeStructure. */ - readonly isNamed: (structure: T_17) => structure is T_17 & NamedNodeStructure; + readonly isNamed: (structure: T_17) => structure is T_17 & NamedNodeStructure; /** Gets if the provided structure is a EnumMemberStructure. */ - readonly isEnumMember: (structure: Structure & { - kind: StructureKind; - }) => structure is EnumMemberStructure; + readonly isEnumMember: (structure: unknown) => structure is EnumMemberStructure; /** Gets if the provided structure is a PropertyNamedNodeStructure. */ - readonly isPropertyNamed: (structure: T_18) => structure is T_18 & PropertyNamedNodeStructure; + readonly isPropertyNamed: (structure: T_18) => structure is T_18 & PropertyNamedNodeStructure; /** Gets if the provided structure is a InitializerExpressionableNodeStructure. */ - readonly isInitializerExpressionable: (structure: T_19) => structure is T_19 & InitializerExpressionableNodeStructure; + readonly isInitializerExpressionable: (structure: T_19) => structure is T_19 & InitializerExpressionableNodeStructure; /** Gets if the provided structure is a ExportAssignmentStructure. */ - readonly isExportAssignment: (structure: Structure & { - kind: StructureKind; - }) => structure is ExportAssignmentStructure; + readonly isExportAssignment: (structure: unknown) => structure is ExportAssignmentStructure; /** Gets if the provided structure is a ExportDeclarationStructure. */ - readonly isExportDeclaration: (structure: Structure & { - kind: StructureKind; - }) => structure is ExportDeclarationStructure; + readonly isExportDeclaration: (structure: unknown) => structure is ExportDeclarationStructure; /** Gets if the provided structure is a ExportSpecifierStructure. */ - readonly isExportSpecifier: (structure: Structure & { - kind: StructureKind; - }) => structure is ExportSpecifierStructure; + readonly isExportSpecifier: (structure: unknown) => structure is ExportSpecifierStructure; /** Gets if the provided structure is a FunctionDeclarationOverloadStructure. */ - readonly isFunctionDeclarationOverload: (structure: Structure & { - kind: StructureKind; - }) => structure is FunctionDeclarationOverloadStructure; + readonly isFunctionDeclarationOverload: (structure: unknown) => structure is FunctionDeclarationOverloadStructure; /** Gets if the provided structure is a AsyncableNodeStructure. */ - readonly isAsyncable: (structure: T_20) => structure is T_20 & AsyncableNodeStructure; + readonly isAsyncable: (structure: T_20) => structure is T_20 & AsyncableNodeStructure; /** Gets if the provided structure is a GeneratorableNodeStructure. */ - readonly isGeneratorable: (structure: T_21) => structure is T_21 & GeneratorableNodeStructure; + readonly isGeneratorable: (structure: T_21) => structure is T_21 & GeneratorableNodeStructure; /** Gets if the provided structure is a FunctionDeclarationStructure. */ - readonly isFunction: (structure: Structure & { - kind: StructureKind; - }) => structure is FunctionDeclarationStructure; + readonly isFunction: (structure: unknown) => structure is FunctionDeclarationStructure; /** Gets if the provided structure is a GetAccessorDeclarationStructure. */ - readonly isGetAccessor: (structure: Structure & { - kind: StructureKind; - }) => structure is GetAccessorDeclarationStructure; + readonly isGetAccessor: (structure: unknown) => structure is GetAccessorDeclarationStructure; /** Gets if the provided structure is a StaticableNodeStructure. */ - readonly isStaticable: (structure: T_22) => structure is T_22 & StaticableNodeStructure; + readonly isStaticable: (structure: T_22) => structure is T_22 & StaticableNodeStructure; /** Gets if the provided structure is a ImportDeclarationStructure. */ - readonly isImportDeclaration: (structure: Structure & { - kind: StructureKind; - }) => structure is ImportDeclarationStructure; + readonly isImportDeclaration: (structure: unknown) => structure is ImportDeclarationStructure; /** Gets if the provided structure is a ImportSpecifierStructure. */ - readonly isImportSpecifier: (structure: Structure & { - kind: StructureKind; - }) => structure is ImportSpecifierStructure; + readonly isImportSpecifier: (structure: unknown) => structure is ImportSpecifierStructure; /** Gets if the provided structure is a IndexSignatureDeclarationStructure. */ - readonly isIndexSignature: (structure: Structure & { - kind: StructureKind; - }) => structure is IndexSignatureDeclarationStructure; + readonly isIndexSignature: (structure: unknown) => structure is IndexSignatureDeclarationStructure; /** Gets if the provided structure is a ReadonlyableNodeStructure. */ - readonly isReadonlyable: (structure: T_23) => structure is T_23 & ReadonlyableNodeStructure; + readonly isReadonlyable: (structure: T_23) => structure is T_23 & ReadonlyableNodeStructure; /** Gets if the provided structure is a InterfaceDeclarationStructure. */ - readonly isInterface: (structure: Structure & { - kind: StructureKind; - }) => structure is InterfaceDeclarationStructure; + readonly isInterface: (structure: unknown) => structure is InterfaceDeclarationStructure; /** Gets if the provided structure is a ExtendsClauseableNodeStructure. */ - readonly isExtendsClauseable: (structure: T_24) => structure is T_24 & ExtendsClauseableNodeStructure; + readonly isExtendsClauseable: (structure: T_24) => structure is T_24 & ExtendsClauseableNodeStructure; /** Gets if the provided structure is a TypeElementMemberedNodeStructure. */ - readonly isTypeElementMembered: (structure: T_25) => structure is T_25 & TypeElementMemberedNodeStructure; + readonly isTypeElementMembered: (structure: T_25) => structure is T_25 & TypeElementMemberedNodeStructure; /** Gets if the provided structure is a JSDocStructure. */ - readonly isJSDoc: (structure: Structure & { - kind: StructureKind; - }) => structure is JSDocStructure; + readonly isJSDoc: (structure: unknown) => structure is JSDocStructure; /** Gets if the provided structure is a JSDocTagStructure. */ - readonly isJSDocTag: (structure: Structure & { - kind: StructureKind; - }) => structure is JSDocTagStructure; + readonly isJSDocTag: (structure: unknown) => structure is JSDocTagStructure; /** Gets if the provided structure is a JsxAttributeStructure. */ - readonly isJsxAttribute: (structure: Structure & { - kind: StructureKind; - }) => structure is JsxAttributeStructure; + readonly isJsxAttribute: (structure: unknown) => structure is JsxAttributeStructure; /** Gets if the provided structure is a JsxElementStructure. */ - readonly isJsxElement: (structure: Structure & { - kind: StructureKind; - }) => structure is JsxElementStructure; + readonly isJsxElement: (structure: unknown) => structure is JsxElementStructure; /** Gets if the provided structure is a JsxSelfClosingElementStructure. */ - readonly isJsxSelfClosingElement: (structure: Structure & { - kind: StructureKind; - }) => structure is JsxSelfClosingElementStructure; + readonly isJsxSelfClosingElement: (structure: unknown) => structure is JsxSelfClosingElementStructure; /** Gets if the provided structure is a JsxTagNamedNodeStructure. */ - readonly isJsxTagNamed: (structure: T_26) => structure is T_26 & JsxTagNamedNodeStructure; + readonly isJsxTagNamed: (structure: T_26) => structure is T_26 & JsxTagNamedNodeStructure; /** Gets if the provided structure is a JsxAttributedNodeStructure. */ - readonly isJsxAttributed: (structure: T_27) => structure is T_27 & JsxAttributedNodeStructure; + readonly isJsxAttributed: (structure: T_27) => structure is T_27 & JsxAttributedNodeStructure; /** Gets if the provided structure is a JsxSpreadAttributeStructure. */ - readonly isJsxSpreadAttribute: (structure: Structure & { - kind: StructureKind; - }) => structure is JsxSpreadAttributeStructure; + readonly isJsxSpreadAttribute: (structure: unknown) => structure is JsxSpreadAttributeStructure; /** Gets if the provided structure is a MethodDeclarationOverloadStructure. */ - readonly isMethodDeclarationOverload: (structure: Structure & { - kind: StructureKind; - }) => structure is MethodDeclarationOverloadStructure; + readonly isMethodDeclarationOverload: (structure: unknown) => structure is MethodDeclarationOverloadStructure; /** Gets if the provided structure is a QuestionTokenableNodeStructure. */ - readonly isQuestionTokenable: (structure: T_28) => structure is T_28 & QuestionTokenableNodeStructure; + readonly isQuestionTokenable: (structure: T_28) => structure is T_28 & QuestionTokenableNodeStructure; /** Gets if the provided structure is a OverrideableNodeStructure. */ - readonly isOverrideable: (structure: T_29) => structure is T_29 & OverrideableNodeStructure; + readonly isOverrideable: (structure: T_29) => structure is T_29 & OverrideableNodeStructure; /** Gets if the provided structure is a MethodDeclarationStructure. */ - readonly isMethod: (structure: Structure & { - kind: StructureKind; - }) => structure is MethodDeclarationStructure; + readonly isMethod: (structure: unknown) => structure is MethodDeclarationStructure; /** Gets if the provided structure is a MethodSignatureStructure. */ - readonly isMethodSignature: (structure: Structure & { - kind: StructureKind; - }) => structure is MethodSignatureStructure; + readonly isMethodSignature: (structure: unknown) => structure is MethodSignatureStructure; /** Gets if the provided structure is a ModuleDeclarationStructure. */ - readonly isModule: (structure: Structure & { - kind: StructureKind; - }) => structure is ModuleDeclarationStructure; + readonly isModule: (structure: unknown) => structure is ModuleDeclarationStructure; /** Gets if the provided structure is a ModuleNamedNodeStructure. */ - readonly isModuleNamed: (structure: T_30) => structure is T_30 & ModuleNamedNodeStructure; + readonly isModuleNamed: (structure: T_30) => structure is T_30 & ModuleNamedNodeStructure; /** Gets if the provided structure is a ParameterDeclarationStructure. */ - readonly isParameter: (structure: Structure & { - kind: StructureKind; - }) => structure is ParameterDeclarationStructure; + readonly isParameter: (structure: unknown) => structure is ParameterDeclarationStructure; /** Gets if the provided structure is a BindingNamedNodeStructure. */ - readonly isBindingNamed: (structure: T_31) => structure is T_31 & BindingNamedNodeStructure; + readonly isBindingNamed: (structure: T_31) => structure is T_31 & BindingNamedNodeStructure; /** Gets if the provided structure is a TypedNodeStructure. */ - readonly isTyped: (structure: T_32) => structure is T_32 & TypedNodeStructure; + readonly isTyped: (structure: T_32) => structure is T_32 & TypedNodeStructure; /** Gets if the provided structure is a ScopeableNodeStructure. */ - readonly isScopeable: (structure: T_33) => structure is T_33 & ScopeableNodeStructure; + readonly isScopeable: (structure: T_33) => structure is T_33 & ScopeableNodeStructure; /** Gets if the provided structure is a PropertyAssignmentStructure. */ - readonly isPropertyAssignment: (structure: Structure & { - kind: StructureKind; - }) => structure is PropertyAssignmentStructure; + readonly isPropertyAssignment: (structure: unknown) => structure is PropertyAssignmentStructure; /** Gets if the provided structure is a PropertyDeclarationStructure. */ - readonly isProperty: (structure: Structure & { - kind: StructureKind; - }) => structure is PropertyDeclarationStructure; + readonly isProperty: (structure: unknown) => structure is PropertyDeclarationStructure; /** Gets if the provided structure is a ExclamationTokenableNodeStructure. */ - readonly isExclamationTokenable: (structure: T_34) => structure is T_34 & ExclamationTokenableNodeStructure; + readonly isExclamationTokenable: (structure: T_34) => structure is T_34 & ExclamationTokenableNodeStructure; /** Gets if the provided structure is a PropertySignatureStructure. */ - readonly isPropertySignature: (structure: Structure & { - kind: StructureKind; - }) => structure is PropertySignatureStructure; + readonly isPropertySignature: (structure: unknown) => structure is PropertySignatureStructure; /** Gets if the provided structure is a SetAccessorDeclarationStructure. */ - readonly isSetAccessor: (structure: Structure & { - kind: StructureKind; - }) => structure is SetAccessorDeclarationStructure; + readonly isSetAccessor: (structure: unknown) => structure is SetAccessorDeclarationStructure; /** Gets if the provided structure is a ShorthandPropertyAssignmentStructure. */ - readonly isShorthandPropertyAssignment: (structure: Structure & { - kind: StructureKind; - }) => structure is ShorthandPropertyAssignmentStructure; + readonly isShorthandPropertyAssignment: (structure: unknown) => structure is ShorthandPropertyAssignmentStructure; /** Gets if the provided structure is a SourceFileStructure. */ - readonly isSourceFile: (structure: Structure & { - kind: StructureKind; - }) => structure is SourceFileStructure; + readonly isSourceFile: (structure: unknown) => structure is SourceFileStructure; /** Gets if the provided structure is a SpreadAssignmentStructure. */ - readonly isSpreadAssignment: (structure: Structure & { - kind: StructureKind; - }) => structure is SpreadAssignmentStructure; + readonly isSpreadAssignment: (structure: unknown) => structure is SpreadAssignmentStructure; /** Gets if the provided structure is a ExpressionedNodeStructure. */ - readonly isExpressioned: (structure: T_35) => structure is T_35 & ExpressionedNodeStructure; + readonly isExpressioned: (structure: T_35) => structure is T_35 & ExpressionedNodeStructure; /** Gets if the provided structure is a TypeAliasDeclarationStructure. */ - readonly isTypeAlias: (structure: Structure & { - kind: StructureKind; - }) => structure is TypeAliasDeclarationStructure; + readonly isTypeAlias: (structure: unknown) => structure is TypeAliasDeclarationStructure; /** Gets if the provided structure is a TypeParameterDeclarationStructure. */ - readonly isTypeParameter: (structure: Structure & { - kind: StructureKind; - }) => structure is TypeParameterDeclarationStructure; + readonly isTypeParameter: (structure: unknown) => structure is TypeParameterDeclarationStructure; /** Gets if the provided structure is a VariableDeclarationStructure. */ - readonly isVariableDeclaration: (structure: Structure & { - kind: StructureKind; - }) => structure is VariableDeclarationStructure; + readonly isVariableDeclaration: (structure: unknown) => structure is VariableDeclarationStructure; /** Gets if the provided structure is a VariableStatementStructure. */ - readonly isVariableStatement: (structure: Structure & { - kind: StructureKind; - }) => structure is VariableStatementStructure; + readonly isVariableStatement: (structure: unknown) => structure is VariableStatementStructure; }; export interface KindedStructure { diff --git a/deno/ts_morph.js b/deno/ts_morph.js index 6f6143085..7a044ce8c 100644 --- a/deno/ts_morph.js +++ b/deno/ts_morph.js @@ -6445,16 +6445,20 @@ const Structure = { return typeof structure.name === "string"; }, isAssertEntry(structure) { - return structure.kind === StructureKind.AssertEntry; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.AssertEntry; }, isAssertionKeyNamed(structure) { - return structure.kind === StructureKind.AssertEntry; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.AssertEntry; }, isCallSignature(structure) { - return structure.kind === StructureKind.CallSignature; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.CallSignature; }, isJSDocable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.CallSignature: case StructureKind.Class: case StructureKind.ClassStaticBlock: @@ -6483,7 +6487,8 @@ const Structure = { } }, isSignatured(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.CallSignature: case StructureKind.ConstructorOverload: case StructureKind.Constructor: @@ -6501,7 +6506,8 @@ const Structure = { } }, isParametered(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.CallSignature: case StructureKind.ConstructorOverload: case StructureKind.Constructor: @@ -6519,7 +6525,8 @@ const Structure = { } }, isReturnTyped(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.CallSignature: case StructureKind.ConstructorOverload: case StructureKind.Constructor: @@ -6538,7 +6545,8 @@ const Structure = { } }, isTypeParametered(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.CallSignature: case StructureKind.Class: case StructureKind.ConstructorOverload: @@ -6559,13 +6567,16 @@ const Structure = { } }, isClass(structure) { - return structure.kind === StructureKind.Class; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Class; }, isClassLikeDeclarationBase(structure) { - return structure.kind === StructureKind.Class; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Class; }, isNameable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Class: case StructureKind.Function: return true; @@ -6574,10 +6585,12 @@ const Structure = { } }, isImplementsClauseable(structure) { - return structure.kind === StructureKind.Class; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Class; }, isDecoratable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Class: case StructureKind.GetAccessor: case StructureKind.Method: @@ -6590,7 +6603,8 @@ const Structure = { } }, isAbstractable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Class: case StructureKind.GetAccessor: case StructureKind.MethodOverload: @@ -6603,7 +6617,8 @@ const Structure = { } }, isAmbientable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Class: case StructureKind.Enum: case StructureKind.FunctionOverload: @@ -6619,7 +6634,8 @@ const Structure = { } }, isExportable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Class: case StructureKind.Enum: case StructureKind.FunctionOverload: @@ -6634,10 +6650,12 @@ const Structure = { } }, isClassStaticBlock(structure) { - return structure.kind === StructureKind.ClassStaticBlock; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.ClassStaticBlock; }, isStatemented(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.ClassStaticBlock: case StructureKind.Constructor: case StructureKind.Function: @@ -6652,10 +6670,12 @@ const Structure = { } }, isConstructorDeclarationOverload(structure) { - return structure.kind === StructureKind.ConstructorOverload; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.ConstructorOverload; }, isScoped(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.ConstructorOverload: case StructureKind.Constructor: case StructureKind.GetAccessor: @@ -6669,10 +6689,12 @@ const Structure = { } }, isConstructor(structure) { - return structure.kind === StructureKind.Constructor; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Constructor; }, isFunctionLike(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Constructor: case StructureKind.Function: case StructureKind.GetAccessor: @@ -6684,16 +6706,20 @@ const Structure = { } }, isConstructSignature(structure) { - return structure.kind === StructureKind.ConstructSignature; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.ConstructSignature; }, isDecorator(structure) { - return structure.kind === StructureKind.Decorator; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Decorator; }, isEnum(structure) { - return structure.kind === StructureKind.Enum; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Enum; }, isNamed(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Enum: case StructureKind.Interface: case StructureKind.JsxAttribute: @@ -6706,10 +6732,12 @@ const Structure = { } }, isEnumMember(structure) { - return structure.kind === StructureKind.EnumMember; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.EnumMember; }, isPropertyNamed(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.EnumMember: case StructureKind.GetAccessor: case StructureKind.Method: @@ -6724,7 +6752,8 @@ const Structure = { } }, isInitializerExpressionable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.EnumMember: case StructureKind.Parameter: case StructureKind.Property: @@ -6736,19 +6765,24 @@ const Structure = { } }, isExportAssignment(structure) { - return structure.kind === StructureKind.ExportAssignment; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.ExportAssignment; }, isExportDeclaration(structure) { - return structure.kind === StructureKind.ExportDeclaration; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.ExportDeclaration; }, isExportSpecifier(structure) { - return structure.kind === StructureKind.ExportSpecifier; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.ExportSpecifier; }, isFunctionDeclarationOverload(structure) { - return structure.kind === StructureKind.FunctionOverload; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.FunctionOverload; }, isAsyncable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.FunctionOverload: case StructureKind.Function: case StructureKind.MethodOverload: @@ -6759,7 +6793,8 @@ const Structure = { } }, isGeneratorable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.FunctionOverload: case StructureKind.Function: case StructureKind.MethodOverload: @@ -6770,13 +6805,16 @@ const Structure = { } }, isFunction(structure) { - return structure.kind === StructureKind.Function; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Function; }, isGetAccessor(structure) { - return structure.kind === StructureKind.GetAccessor; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.GetAccessor; }, isStaticable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.GetAccessor: case StructureKind.MethodOverload: case StructureKind.Method: @@ -6788,16 +6826,20 @@ const Structure = { } }, isImportDeclaration(structure) { - return structure.kind === StructureKind.ImportDeclaration; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.ImportDeclaration; }, isImportSpecifier(structure) { - return structure.kind === StructureKind.ImportSpecifier; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.ImportSpecifier; }, isIndexSignature(structure) { - return structure.kind === StructureKind.IndexSignature; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.IndexSignature; }, isReadonlyable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.IndexSignature: case StructureKind.Parameter: case StructureKind.Property: @@ -6808,43 +6850,56 @@ const Structure = { } }, isInterface(structure) { - return structure.kind === StructureKind.Interface; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Interface; }, isExtendsClauseable(structure) { - return structure.kind === StructureKind.Interface; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Interface; }, isTypeElementMembered(structure) { - return structure.kind === StructureKind.Interface; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Interface; }, isJSDoc(structure) { - return structure.kind === StructureKind.JSDoc; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.JSDoc; }, isJSDocTag(structure) { - return structure.kind === StructureKind.JSDocTag; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.JSDocTag; }, isJsxAttribute(structure) { - return structure.kind === StructureKind.JsxAttribute; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.JsxAttribute; }, isJsxElement(structure) { - return structure.kind === StructureKind.JsxElement; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.JsxElement; }, isJsxSelfClosingElement(structure) { - return structure.kind === StructureKind.JsxSelfClosingElement; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.JsxSelfClosingElement; }, isJsxTagNamed(structure) { - return structure.kind === StructureKind.JsxSelfClosingElement; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.JsxSelfClosingElement; }, isJsxAttributed(structure) { - return structure.kind === StructureKind.JsxSelfClosingElement; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.JsxSelfClosingElement; }, isJsxSpreadAttribute(structure) { - return structure.kind === StructureKind.JsxSpreadAttribute; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.JsxSpreadAttribute; }, isMethodDeclarationOverload(structure) { - return structure.kind === StructureKind.MethodOverload; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.MethodOverload; }, isQuestionTokenable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.MethodOverload: case StructureKind.Method: case StructureKind.MethodSignature: @@ -6857,7 +6912,8 @@ const Structure = { } }, isOverrideable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.MethodOverload: case StructureKind.Method: case StructureKind.Parameter: @@ -6868,22 +6924,28 @@ const Structure = { } }, isMethod(structure) { - return structure.kind === StructureKind.Method; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Method; }, isMethodSignature(structure) { - return structure.kind === StructureKind.MethodSignature; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.MethodSignature; }, isModule(structure) { - return structure.kind === StructureKind.Module; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Module; }, isModuleNamed(structure) { - return structure.kind === StructureKind.Module; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Module; }, isParameter(structure) { - return structure.kind === StructureKind.Parameter; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Parameter; }, isBindingNamed(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Parameter: case StructureKind.VariableDeclaration: return true; @@ -6892,7 +6954,8 @@ const Structure = { } }, isTyped(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Parameter: case StructureKind.Property: case StructureKind.PropertySignature: @@ -6904,16 +6967,20 @@ const Structure = { } }, isScopeable(structure) { - return structure.kind === StructureKind.Parameter; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Parameter; }, isPropertyAssignment(structure) { - return structure.kind === StructureKind.PropertyAssignment; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.PropertyAssignment; }, isProperty(structure) { - return structure.kind === StructureKind.Property; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.Property; }, isExclamationTokenable(structure) { - switch (structure.kind) { + var _a; + switch ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) { case StructureKind.Property: case StructureKind.VariableDeclaration: return true; @@ -6922,34 +6989,44 @@ const Structure = { } }, isPropertySignature(structure) { - return structure.kind === StructureKind.PropertySignature; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.PropertySignature; }, isSetAccessor(structure) { - return structure.kind === StructureKind.SetAccessor; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.SetAccessor; }, isShorthandPropertyAssignment(structure) { - return structure.kind === StructureKind.ShorthandPropertyAssignment; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.ShorthandPropertyAssignment; }, isSourceFile(structure) { - return structure.kind === StructureKind.SourceFile; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.SourceFile; }, isSpreadAssignment(structure) { - return structure.kind === StructureKind.SpreadAssignment; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.SpreadAssignment; }, isExpressioned(structure) { - return structure.kind === StructureKind.SpreadAssignment; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.SpreadAssignment; }, isTypeAlias(structure) { - return structure.kind === StructureKind.TypeAlias; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.TypeAlias; }, isTypeParameter(structure) { - return structure.kind === StructureKind.TypeParameter; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.TypeParameter; }, isVariableDeclaration(structure) { - return structure.kind === StructureKind.VariableDeclaration; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.VariableDeclaration; }, isVariableStatement(structure) { - return structure.kind === StructureKind.VariableStatement; + var _a; + return ((_a = structure) === null || _a === void 0 ? void 0 : _a.kind) === StructureKind.VariableStatement; } }; diff --git a/packages/ts-morph/lib/ts-morph.d.ts b/packages/ts-morph/lib/ts-morph.d.ts index 3eb8449e1..e1f658bf3 100644 --- a/packages/ts-morph/lib/ts-morph.d.ts +++ b/packages/ts-morph/lib/ts-morph.d.ts @@ -10687,313 +10687,159 @@ export declare const Structure: { name: string; }; /** Gets if the provided structure is a AssertEntryStructure. */ - readonly isAssertEntry: (structure: Structure & { - kind: StructureKind; - }) => structure is AssertEntryStructure; + readonly isAssertEntry: (structure: unknown) => structure is AssertEntryStructure; /** Gets if the provided structure is a AssertionKeyNamedNodeStructure. */ - readonly isAssertionKeyNamed: (structure: T_1) => structure is T_1 & AssertionKeyNamedNodeStructure; + readonly isAssertionKeyNamed: (structure: T_1) => structure is T_1 & AssertionKeyNamedNodeStructure; /** Gets if the provided structure is a CallSignatureDeclarationStructure. */ - readonly isCallSignature: (structure: Structure & { - kind: StructureKind; - }) => structure is CallSignatureDeclarationStructure; + readonly isCallSignature: (structure: unknown) => structure is CallSignatureDeclarationStructure; /** Gets if the provided structure is a JSDocableNodeStructure. */ - readonly isJSDocable: (structure: T_2) => structure is T_2 & JSDocableNodeStructure; + readonly isJSDocable: (structure: T_2) => structure is T_2 & JSDocableNodeStructure; /** Gets if the provided structure is a SignaturedDeclarationStructure. */ - readonly isSignatured: (structure: T_3) => structure is T_3 & SignaturedDeclarationStructure; + readonly isSignatured: (structure: T_3) => structure is T_3 & SignaturedDeclarationStructure; /** Gets if the provided structure is a ParameteredNodeStructure. */ - readonly isParametered: (structure: T_4) => structure is T_4 & ParameteredNodeStructure; + readonly isParametered: (structure: T_4) => structure is T_4 & ParameteredNodeStructure; /** Gets if the provided structure is a ReturnTypedNodeStructure. */ - readonly isReturnTyped: (structure: T_5) => structure is T_5 & ReturnTypedNodeStructure; + readonly isReturnTyped: (structure: T_5) => structure is T_5 & ReturnTypedNodeStructure; /** Gets if the provided structure is a TypeParameteredNodeStructure. */ - readonly isTypeParametered: (structure: T_6) => structure is T_6 & TypeParameteredNodeStructure; + readonly isTypeParametered: (structure: T_6) => structure is T_6 & TypeParameteredNodeStructure; /** Gets if the provided structure is a ClassDeclarationStructure. */ - readonly isClass: (structure: Structure & { - kind: StructureKind; - }) => structure is ClassDeclarationStructure; + readonly isClass: (structure: unknown) => structure is ClassDeclarationStructure; /** Gets if the provided structure is a ClassLikeDeclarationBaseStructure. */ - readonly isClassLikeDeclarationBase: (structure: T_7) => structure is T_7 & ClassLikeDeclarationBaseStructure; + readonly isClassLikeDeclarationBase: (structure: T_7) => structure is T_7 & ClassLikeDeclarationBaseStructure; /** Gets if the provided structure is a NameableNodeStructure. */ - readonly isNameable: (structure: T_8) => structure is T_8 & NameableNodeStructure; + readonly isNameable: (structure: T_8) => structure is T_8 & NameableNodeStructure; /** Gets if the provided structure is a ImplementsClauseableNodeStructure. */ - readonly isImplementsClauseable: (structure: T_9) => structure is T_9 & ImplementsClauseableNodeStructure; + readonly isImplementsClauseable: (structure: T_9) => structure is T_9 & ImplementsClauseableNodeStructure; /** Gets if the provided structure is a DecoratableNodeStructure. */ - readonly isDecoratable: (structure: T_10) => structure is T_10 & DecoratableNodeStructure; + readonly isDecoratable: (structure: T_10) => structure is T_10 & DecoratableNodeStructure; /** Gets if the provided structure is a AbstractableNodeStructure. */ - readonly isAbstractable: (structure: T_11) => structure is T_11 & AbstractableNodeStructure; + readonly isAbstractable: (structure: T_11) => structure is T_11 & AbstractableNodeStructure; /** Gets if the provided structure is a AmbientableNodeStructure. */ - readonly isAmbientable: (structure: T_12) => structure is T_12 & AmbientableNodeStructure; + readonly isAmbientable: (structure: T_12) => structure is T_12 & AmbientableNodeStructure; /** Gets if the provided structure is a ExportableNodeStructure. */ - readonly isExportable: (structure: T_13) => structure is T_13 & ExportableNodeStructure; + readonly isExportable: (structure: T_13) => structure is T_13 & ExportableNodeStructure; /** Gets if the provided structure is a ClassStaticBlockDeclarationStructure. */ - readonly isClassStaticBlock: (structure: Structure & { - kind: StructureKind; - }) => structure is ClassStaticBlockDeclarationStructure; + readonly isClassStaticBlock: (structure: unknown) => structure is ClassStaticBlockDeclarationStructure; /** Gets if the provided structure is a StatementedNodeStructure. */ - readonly isStatemented: (structure: T_14) => structure is T_14 & StatementedNodeStructure; + readonly isStatemented: (structure: T_14) => structure is T_14 & StatementedNodeStructure; /** Gets if the provided structure is a ConstructorDeclarationOverloadStructure. */ - readonly isConstructorDeclarationOverload: (structure: Structure & { - kind: StructureKind; - }) => structure is ConstructorDeclarationOverloadStructure; + readonly isConstructorDeclarationOverload: (structure: unknown) => structure is ConstructorDeclarationOverloadStructure; /** Gets if the provided structure is a ScopedNodeStructure. */ - readonly isScoped: (structure: T_15) => structure is T_15 & ScopedNodeStructure; + readonly isScoped: (structure: T_15) => structure is T_15 & ScopedNodeStructure; /** Gets if the provided structure is a ConstructorDeclarationStructure. */ - readonly isConstructor: (structure: Structure & { - kind: StructureKind; - }) => structure is ConstructorDeclarationStructure; + readonly isConstructor: (structure: unknown) => structure is ConstructorDeclarationStructure; /** Gets if the provided structure is a FunctionLikeDeclarationStructure. */ - readonly isFunctionLike: (structure: T_16) => structure is T_16 & FunctionLikeDeclarationStructure; + readonly isFunctionLike: (structure: T_16) => structure is T_16 & FunctionLikeDeclarationStructure; /** Gets if the provided structure is a ConstructSignatureDeclarationStructure. */ - readonly isConstructSignature: (structure: Structure & { - kind: StructureKind; - }) => structure is ConstructSignatureDeclarationStructure; + readonly isConstructSignature: (structure: unknown) => structure is ConstructSignatureDeclarationStructure; /** Gets if the provided structure is a DecoratorStructure. */ - readonly isDecorator: (structure: Structure & { - kind: StructureKind; - }) => structure is DecoratorStructure; + readonly isDecorator: (structure: unknown) => structure is DecoratorStructure; /** Gets if the provided structure is a EnumDeclarationStructure. */ - readonly isEnum: (structure: Structure & { - kind: StructureKind; - }) => structure is EnumDeclarationStructure; + readonly isEnum: (structure: unknown) => structure is EnumDeclarationStructure; /** Gets if the provided structure is a NamedNodeStructure. */ - readonly isNamed: (structure: T_17) => structure is T_17 & NamedNodeStructure; + readonly isNamed: (structure: T_17) => structure is T_17 & NamedNodeStructure; /** Gets if the provided structure is a EnumMemberStructure. */ - readonly isEnumMember: (structure: Structure & { - kind: StructureKind; - }) => structure is EnumMemberStructure; + readonly isEnumMember: (structure: unknown) => structure is EnumMemberStructure; /** Gets if the provided structure is a PropertyNamedNodeStructure. */ - readonly isPropertyNamed: (structure: T_18) => structure is T_18 & PropertyNamedNodeStructure; + readonly isPropertyNamed: (structure: T_18) => structure is T_18 & PropertyNamedNodeStructure; /** Gets if the provided structure is a InitializerExpressionableNodeStructure. */ - readonly isInitializerExpressionable: (structure: T_19) => structure is T_19 & InitializerExpressionableNodeStructure; + readonly isInitializerExpressionable: (structure: T_19) => structure is T_19 & InitializerExpressionableNodeStructure; /** Gets if the provided structure is a ExportAssignmentStructure. */ - readonly isExportAssignment: (structure: Structure & { - kind: StructureKind; - }) => structure is ExportAssignmentStructure; + readonly isExportAssignment: (structure: unknown) => structure is ExportAssignmentStructure; /** Gets if the provided structure is a ExportDeclarationStructure. */ - readonly isExportDeclaration: (structure: Structure & { - kind: StructureKind; - }) => structure is ExportDeclarationStructure; + readonly isExportDeclaration: (structure: unknown) => structure is ExportDeclarationStructure; /** Gets if the provided structure is a ExportSpecifierStructure. */ - readonly isExportSpecifier: (structure: Structure & { - kind: StructureKind; - }) => structure is ExportSpecifierStructure; + readonly isExportSpecifier: (structure: unknown) => structure is ExportSpecifierStructure; /** Gets if the provided structure is a FunctionDeclarationOverloadStructure. */ - readonly isFunctionDeclarationOverload: (structure: Structure & { - kind: StructureKind; - }) => structure is FunctionDeclarationOverloadStructure; + readonly isFunctionDeclarationOverload: (structure: unknown) => structure is FunctionDeclarationOverloadStructure; /** Gets if the provided structure is a AsyncableNodeStructure. */ - readonly isAsyncable: (structure: T_20) => structure is T_20 & AsyncableNodeStructure; + readonly isAsyncable: (structure: T_20) => structure is T_20 & AsyncableNodeStructure; /** Gets if the provided structure is a GeneratorableNodeStructure. */ - readonly isGeneratorable: (structure: T_21) => structure is T_21 & GeneratorableNodeStructure; + readonly isGeneratorable: (structure: T_21) => structure is T_21 & GeneratorableNodeStructure; /** Gets if the provided structure is a FunctionDeclarationStructure. */ - readonly isFunction: (structure: Structure & { - kind: StructureKind; - }) => structure is FunctionDeclarationStructure; + readonly isFunction: (structure: unknown) => structure is FunctionDeclarationStructure; /** Gets if the provided structure is a GetAccessorDeclarationStructure. */ - readonly isGetAccessor: (structure: Structure & { - kind: StructureKind; - }) => structure is GetAccessorDeclarationStructure; + readonly isGetAccessor: (structure: unknown) => structure is GetAccessorDeclarationStructure; /** Gets if the provided structure is a StaticableNodeStructure. */ - readonly isStaticable: (structure: T_22) => structure is T_22 & StaticableNodeStructure; + readonly isStaticable: (structure: T_22) => structure is T_22 & StaticableNodeStructure; /** Gets if the provided structure is a ImportDeclarationStructure. */ - readonly isImportDeclaration: (structure: Structure & { - kind: StructureKind; - }) => structure is ImportDeclarationStructure; + readonly isImportDeclaration: (structure: unknown) => structure is ImportDeclarationStructure; /** Gets if the provided structure is a ImportSpecifierStructure. */ - readonly isImportSpecifier: (structure: Structure & { - kind: StructureKind; - }) => structure is ImportSpecifierStructure; + readonly isImportSpecifier: (structure: unknown) => structure is ImportSpecifierStructure; /** Gets if the provided structure is a IndexSignatureDeclarationStructure. */ - readonly isIndexSignature: (structure: Structure & { - kind: StructureKind; - }) => structure is IndexSignatureDeclarationStructure; + readonly isIndexSignature: (structure: unknown) => structure is IndexSignatureDeclarationStructure; /** Gets if the provided structure is a ReadonlyableNodeStructure. */ - readonly isReadonlyable: (structure: T_23) => structure is T_23 & ReadonlyableNodeStructure; + readonly isReadonlyable: (structure: T_23) => structure is T_23 & ReadonlyableNodeStructure; /** Gets if the provided structure is a InterfaceDeclarationStructure. */ - readonly isInterface: (structure: Structure & { - kind: StructureKind; - }) => structure is InterfaceDeclarationStructure; + readonly isInterface: (structure: unknown) => structure is InterfaceDeclarationStructure; /** Gets if the provided structure is a ExtendsClauseableNodeStructure. */ - readonly isExtendsClauseable: (structure: T_24) => structure is T_24 & ExtendsClauseableNodeStructure; + readonly isExtendsClauseable: (structure: T_24) => structure is T_24 & ExtendsClauseableNodeStructure; /** Gets if the provided structure is a TypeElementMemberedNodeStructure. */ - readonly isTypeElementMembered: (structure: T_25) => structure is T_25 & TypeElementMemberedNodeStructure; + readonly isTypeElementMembered: (structure: T_25) => structure is T_25 & TypeElementMemberedNodeStructure; /** Gets if the provided structure is a JSDocStructure. */ - readonly isJSDoc: (structure: Structure & { - kind: StructureKind; - }) => structure is JSDocStructure; + readonly isJSDoc: (structure: unknown) => structure is JSDocStructure; /** Gets if the provided structure is a JSDocTagStructure. */ - readonly isJSDocTag: (structure: Structure & { - kind: StructureKind; - }) => structure is JSDocTagStructure; + readonly isJSDocTag: (structure: unknown) => structure is JSDocTagStructure; /** Gets if the provided structure is a JsxAttributeStructure. */ - readonly isJsxAttribute: (structure: Structure & { - kind: StructureKind; - }) => structure is JsxAttributeStructure; + readonly isJsxAttribute: (structure: unknown) => structure is JsxAttributeStructure; /** Gets if the provided structure is a JsxElementStructure. */ - readonly isJsxElement: (structure: Structure & { - kind: StructureKind; - }) => structure is JsxElementStructure; + readonly isJsxElement: (structure: unknown) => structure is JsxElementStructure; /** Gets if the provided structure is a JsxSelfClosingElementStructure. */ - readonly isJsxSelfClosingElement: (structure: Structure & { - kind: StructureKind; - }) => structure is JsxSelfClosingElementStructure; + readonly isJsxSelfClosingElement: (structure: unknown) => structure is JsxSelfClosingElementStructure; /** Gets if the provided structure is a JsxTagNamedNodeStructure. */ - readonly isJsxTagNamed: (structure: T_26) => structure is T_26 & JsxTagNamedNodeStructure; + readonly isJsxTagNamed: (structure: T_26) => structure is T_26 & JsxTagNamedNodeStructure; /** Gets if the provided structure is a JsxAttributedNodeStructure. */ - readonly isJsxAttributed: (structure: T_27) => structure is T_27 & JsxAttributedNodeStructure; + readonly isJsxAttributed: (structure: T_27) => structure is T_27 & JsxAttributedNodeStructure; /** Gets if the provided structure is a JsxSpreadAttributeStructure. */ - readonly isJsxSpreadAttribute: (structure: Structure & { - kind: StructureKind; - }) => structure is JsxSpreadAttributeStructure; + readonly isJsxSpreadAttribute: (structure: unknown) => structure is JsxSpreadAttributeStructure; /** Gets if the provided structure is a MethodDeclarationOverloadStructure. */ - readonly isMethodDeclarationOverload: (structure: Structure & { - kind: StructureKind; - }) => structure is MethodDeclarationOverloadStructure; + readonly isMethodDeclarationOverload: (structure: unknown) => structure is MethodDeclarationOverloadStructure; /** Gets if the provided structure is a QuestionTokenableNodeStructure. */ - readonly isQuestionTokenable: (structure: T_28) => structure is T_28 & QuestionTokenableNodeStructure; + readonly isQuestionTokenable: (structure: T_28) => structure is T_28 & QuestionTokenableNodeStructure; /** Gets if the provided structure is a OverrideableNodeStructure. */ - readonly isOverrideable: (structure: T_29) => structure is T_29 & OverrideableNodeStructure; + readonly isOverrideable: (structure: T_29) => structure is T_29 & OverrideableNodeStructure; /** Gets if the provided structure is a MethodDeclarationStructure. */ - readonly isMethod: (structure: Structure & { - kind: StructureKind; - }) => structure is MethodDeclarationStructure; + readonly isMethod: (structure: unknown) => structure is MethodDeclarationStructure; /** Gets if the provided structure is a MethodSignatureStructure. */ - readonly isMethodSignature: (structure: Structure & { - kind: StructureKind; - }) => structure is MethodSignatureStructure; + readonly isMethodSignature: (structure: unknown) => structure is MethodSignatureStructure; /** Gets if the provided structure is a ModuleDeclarationStructure. */ - readonly isModule: (structure: Structure & { - kind: StructureKind; - }) => structure is ModuleDeclarationStructure; + readonly isModule: (structure: unknown) => structure is ModuleDeclarationStructure; /** Gets if the provided structure is a ModuleNamedNodeStructure. */ - readonly isModuleNamed: (structure: T_30) => structure is T_30 & ModuleNamedNodeStructure; + readonly isModuleNamed: (structure: T_30) => structure is T_30 & ModuleNamedNodeStructure; /** Gets if the provided structure is a ParameterDeclarationStructure. */ - readonly isParameter: (structure: Structure & { - kind: StructureKind; - }) => structure is ParameterDeclarationStructure; + readonly isParameter: (structure: unknown) => structure is ParameterDeclarationStructure; /** Gets if the provided structure is a BindingNamedNodeStructure. */ - readonly isBindingNamed: (structure: T_31) => structure is T_31 & BindingNamedNodeStructure; + readonly isBindingNamed: (structure: T_31) => structure is T_31 & BindingNamedNodeStructure; /** Gets if the provided structure is a TypedNodeStructure. */ - readonly isTyped: (structure: T_32) => structure is T_32 & TypedNodeStructure; + readonly isTyped: (structure: T_32) => structure is T_32 & TypedNodeStructure; /** Gets if the provided structure is a ScopeableNodeStructure. */ - readonly isScopeable: (structure: T_33) => structure is T_33 & ScopeableNodeStructure; + readonly isScopeable: (structure: T_33) => structure is T_33 & ScopeableNodeStructure; /** Gets if the provided structure is a PropertyAssignmentStructure. */ - readonly isPropertyAssignment: (structure: Structure & { - kind: StructureKind; - }) => structure is PropertyAssignmentStructure; + readonly isPropertyAssignment: (structure: unknown) => structure is PropertyAssignmentStructure; /** Gets if the provided structure is a PropertyDeclarationStructure. */ - readonly isProperty: (structure: Structure & { - kind: StructureKind; - }) => structure is PropertyDeclarationStructure; + readonly isProperty: (structure: unknown) => structure is PropertyDeclarationStructure; /** Gets if the provided structure is a ExclamationTokenableNodeStructure. */ - readonly isExclamationTokenable: (structure: T_34) => structure is T_34 & ExclamationTokenableNodeStructure; + readonly isExclamationTokenable: (structure: T_34) => structure is T_34 & ExclamationTokenableNodeStructure; /** Gets if the provided structure is a PropertySignatureStructure. */ - readonly isPropertySignature: (structure: Structure & { - kind: StructureKind; - }) => structure is PropertySignatureStructure; + readonly isPropertySignature: (structure: unknown) => structure is PropertySignatureStructure; /** Gets if the provided structure is a SetAccessorDeclarationStructure. */ - readonly isSetAccessor: (structure: Structure & { - kind: StructureKind; - }) => structure is SetAccessorDeclarationStructure; + readonly isSetAccessor: (structure: unknown) => structure is SetAccessorDeclarationStructure; /** Gets if the provided structure is a ShorthandPropertyAssignmentStructure. */ - readonly isShorthandPropertyAssignment: (structure: Structure & { - kind: StructureKind; - }) => structure is ShorthandPropertyAssignmentStructure; + readonly isShorthandPropertyAssignment: (structure: unknown) => structure is ShorthandPropertyAssignmentStructure; /** Gets if the provided structure is a SourceFileStructure. */ - readonly isSourceFile: (structure: Structure & { - kind: StructureKind; - }) => structure is SourceFileStructure; + readonly isSourceFile: (structure: unknown) => structure is SourceFileStructure; /** Gets if the provided structure is a SpreadAssignmentStructure. */ - readonly isSpreadAssignment: (structure: Structure & { - kind: StructureKind; - }) => structure is SpreadAssignmentStructure; + readonly isSpreadAssignment: (structure: unknown) => structure is SpreadAssignmentStructure; /** Gets if the provided structure is a ExpressionedNodeStructure. */ - readonly isExpressioned: (structure: T_35) => structure is T_35 & ExpressionedNodeStructure; + readonly isExpressioned: (structure: T_35) => structure is T_35 & ExpressionedNodeStructure; /** Gets if the provided structure is a TypeAliasDeclarationStructure. */ - readonly isTypeAlias: (structure: Structure & { - kind: StructureKind; - }) => structure is TypeAliasDeclarationStructure; + readonly isTypeAlias: (structure: unknown) => structure is TypeAliasDeclarationStructure; /** Gets if the provided structure is a TypeParameterDeclarationStructure. */ - readonly isTypeParameter: (structure: Structure & { - kind: StructureKind; - }) => structure is TypeParameterDeclarationStructure; + readonly isTypeParameter: (structure: unknown) => structure is TypeParameterDeclarationStructure; /** Gets if the provided structure is a VariableDeclarationStructure. */ - readonly isVariableDeclaration: (structure: Structure & { - kind: StructureKind; - }) => structure is VariableDeclarationStructure; + readonly isVariableDeclaration: (structure: unknown) => structure is VariableDeclarationStructure; /** Gets if the provided structure is a VariableStatementStructure. */ - readonly isVariableStatement: (structure: Structure & { - kind: StructureKind; - }) => structure is VariableStatementStructure; + readonly isVariableStatement: (structure: unknown) => structure is VariableStatementStructure; }; export interface KindedStructure { diff --git a/packages/ts-morph/scripts/generation/createStructureTypeGuards.ts b/packages/ts-morph/scripts/generation/createStructureTypeGuards.ts index 67a79770c..44651a05b 100644 --- a/packages/ts-morph/scripts/generation/createStructureTypeGuards.ts +++ b/packages/ts-morph/scripts/generation/createStructureTypeGuards.ts @@ -1,7 +1,7 @@ /** * Code Manipulation - Create type guards on `Structure` * ------------------------------------------------- - * This modifies the Structure.ts file that is used + * This modifies the Structure.generated.ts file that is used * for doing type guards on structures. * ------------------------------------------------- */ @@ -9,7 +9,7 @@ import { tsMorph } from "../deps.ts"; import { Structure, TsMorphInspector } from "../inspectors/mod.ts"; export function createStructureTypeGuards(inspector: TsMorphInspector) { - const structureTypeGuardsFile = inspector.getProject().getSourceFileOrThrow("Structure.ts"); + const structureTypeGuardsFile = inspector.getProject().getSourceFileOrThrow("Structure.generated.ts"); const typeGuardsExpr = structureTypeGuardsFile .getVariableDeclarationOrThrow("Structure") .getInitializerIfKindOrThrow(tsMorph.SyntaxKind.AsExpression) @@ -86,9 +86,9 @@ function addNewMethods(typeGuardsExpr: tsMorph.ObjectLiteralExpression, structur typeParameters: getTypeParameters(info), statements: writer => { if (info.kinds.size === 1) - writer.write(`return structure.kind === StructureKind.${Array.from(info.kinds)[0]};`); + writer.write(`return (structure as any)?.kind === StructureKind.${Array.from(info.kinds)[0]};`); else { - writer.write("switch (structure.kind)").block(() => { + writer.write("switch ((structure as any)?.kind)").block(() => { for (const kind of info.kinds) writer.writeLine(`case StructureKind.${kind}:`); @@ -102,14 +102,14 @@ function addNewMethods(typeGuardsExpr: tsMorph.ObjectLiteralExpression, structur function getTypeParameters(info: StructureInfo): tsMorph.OptionalKind[] { if (info.kind == null) - return [{ name: "T", constraint: "Structure & { kind: StructureKind; }" }]; + return [{ name: "T" }]; return []; } function getParameterType(info: StructureInfo) { if (info.kind == null) return "T"; - return "Structure & { kind: StructureKind; }"; + return "unknown"; } function getReturnType(info: StructureInfo) { diff --git a/packages/ts-morph/src/structures/Structure.ts b/packages/ts-morph/src/structures/Structure.generated.ts similarity index 57% rename from packages/ts-morph/src/structures/Structure.ts rename to packages/ts-morph/src/structures/Structure.generated.ts index d971dce0c..7a5d5e4dc 100644 --- a/packages/ts-morph/src/structures/Structure.ts +++ b/packages/ts-morph/src/structures/Structure.generated.ts @@ -6,14 +6,10 @@ import { NameableNodeStructure, AsyncableNodeStructure, ImplementsClauseableNode PropertyNamedNodeStructure, StaticableNodeStructure, TypeParameteredNodeStructure, GeneratorableNodeStructure, QuestionTokenableNodeStructure, TypedNodeStructure, ExclamationTokenableNodeStructure, ReadonlyableNodeStructure, InitializerExpressionableNodeStructure, NamedNodeStructure, BindingNamedNodeStructure, ScopeableNodeStructure, ExtendsClauseableNodeStructure, TypeElementMemberedNodeStructure, - DecoratableNodeStructure, - ModuleNamedNodeStructure, - OverrideableNodeStructure, - AssertionKeyNamedNodeStructure} from "./base"; + DecoratableNodeStructure, ModuleNamedNodeStructure, OverrideableNodeStructure, AssertionKeyNamedNodeStructure} from "./base"; import { ClassDeclarationStructure, ClassLikeDeclarationBaseStructure, ConstructorDeclarationStructure, ConstructorDeclarationOverloadStructure, GetAccessorDeclarationStructure, MethodDeclarationStructure, MethodDeclarationOverloadStructure, PropertyDeclarationStructure, - SetAccessorDeclarationStructure, - ClassStaticBlockDeclarationStructure} from "./class"; + SetAccessorDeclarationStructure, ClassStaticBlockDeclarationStructure} from "./class"; import { DecoratorStructure } from "./decorator"; import { JSDocStructure, JSDocTagStructure } from "./doc"; import { EnumDeclarationStructure, EnumMemberStructure } from "./enum"; @@ -52,20 +48,20 @@ export const Structure = { return typeof (structure as any).name === "string"; }, /** Gets if the provided structure is a AssertEntryStructure. */ - isAssertEntry(structure: Structure & { kind: StructureKind; }): structure is AssertEntryStructure { - return structure.kind === StructureKind.AssertEntry; + isAssertEntry(structure: unknown): structure is AssertEntryStructure { + return (structure as any)?.kind === StructureKind.AssertEntry; }, /** Gets if the provided structure is a AssertionKeyNamedNodeStructure. */ - isAssertionKeyNamed(structure: T): structure is T & AssertionKeyNamedNodeStructure { - return structure.kind === StructureKind.AssertEntry; + isAssertionKeyNamed(structure: T): structure is T & AssertionKeyNamedNodeStructure { + return (structure as any)?.kind === StructureKind.AssertEntry; }, /** Gets if the provided structure is a CallSignatureDeclarationStructure. */ - isCallSignature(structure: Structure & { kind: StructureKind; }): structure is CallSignatureDeclarationStructure { - return structure.kind === StructureKind.CallSignature; + isCallSignature(structure: unknown): structure is CallSignatureDeclarationStructure { + return (structure as any)?.kind === StructureKind.CallSignature; }, /** Gets if the provided structure is a JSDocableNodeStructure. */ - isJSDocable(structure: T): structure is T & JSDocableNodeStructure { - switch (structure.kind) { + isJSDocable(structure: T): structure is T & JSDocableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.CallSignature: case StructureKind.Class: case StructureKind.ClassStaticBlock: @@ -94,8 +90,8 @@ export const Structure = { } }, /** Gets if the provided structure is a SignaturedDeclarationStructure. */ - isSignatured(structure: T): structure is T & SignaturedDeclarationStructure { - switch (structure.kind) { + isSignatured(structure: T): structure is T & SignaturedDeclarationStructure { + switch ((structure as any)?.kind) { case StructureKind.CallSignature: case StructureKind.ConstructorOverload: case StructureKind.Constructor: @@ -113,8 +109,8 @@ export const Structure = { } }, /** Gets if the provided structure is a ParameteredNodeStructure. */ - isParametered(structure: T): structure is T & ParameteredNodeStructure { - switch (structure.kind) { + isParametered(structure: T): structure is T & ParameteredNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.CallSignature: case StructureKind.ConstructorOverload: case StructureKind.Constructor: @@ -132,8 +128,8 @@ export const Structure = { } }, /** Gets if the provided structure is a ReturnTypedNodeStructure. */ - isReturnTyped(structure: T): structure is T & ReturnTypedNodeStructure { - switch (structure.kind) { + isReturnTyped(structure: T): structure is T & ReturnTypedNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.CallSignature: case StructureKind.ConstructorOverload: case StructureKind.Constructor: @@ -152,8 +148,8 @@ export const Structure = { } }, /** Gets if the provided structure is a TypeParameteredNodeStructure. */ - isTypeParametered(structure: T): structure is T & TypeParameteredNodeStructure { - switch (structure.kind) { + isTypeParametered(structure: T): structure is T & TypeParameteredNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.CallSignature: case StructureKind.Class: case StructureKind.ConstructorOverload: @@ -174,16 +170,16 @@ export const Structure = { } }, /** Gets if the provided structure is a ClassDeclarationStructure. */ - isClass(structure: Structure & { kind: StructureKind; }): structure is ClassDeclarationStructure { - return structure.kind === StructureKind.Class; + isClass(structure: unknown): structure is ClassDeclarationStructure { + return (structure as any)?.kind === StructureKind.Class; }, /** Gets if the provided structure is a ClassLikeDeclarationBaseStructure. */ - isClassLikeDeclarationBase(structure: T): structure is T & ClassLikeDeclarationBaseStructure { - return structure.kind === StructureKind.Class; + isClassLikeDeclarationBase(structure: T): structure is T & ClassLikeDeclarationBaseStructure { + return (structure as any)?.kind === StructureKind.Class; }, /** Gets if the provided structure is a NameableNodeStructure. */ - isNameable(structure: T): structure is T & NameableNodeStructure { - switch (structure.kind) { + isNameable(structure: T): structure is T & NameableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.Class: case StructureKind.Function: return true; @@ -192,12 +188,12 @@ export const Structure = { } }, /** Gets if the provided structure is a ImplementsClauseableNodeStructure. */ - isImplementsClauseable(structure: T): structure is T & ImplementsClauseableNodeStructure { - return structure.kind === StructureKind.Class; + isImplementsClauseable(structure: T): structure is T & ImplementsClauseableNodeStructure { + return (structure as any)?.kind === StructureKind.Class; }, /** Gets if the provided structure is a DecoratableNodeStructure. */ - isDecoratable(structure: T): structure is T & DecoratableNodeStructure { - switch (structure.kind) { + isDecoratable(structure: T): structure is T & DecoratableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.Class: case StructureKind.GetAccessor: case StructureKind.Method: @@ -210,8 +206,8 @@ export const Structure = { } }, /** Gets if the provided structure is a AbstractableNodeStructure. */ - isAbstractable(structure: T): structure is T & AbstractableNodeStructure { - switch (structure.kind) { + isAbstractable(structure: T): structure is T & AbstractableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.Class: case StructureKind.GetAccessor: case StructureKind.MethodOverload: @@ -224,8 +220,8 @@ export const Structure = { } }, /** Gets if the provided structure is a AmbientableNodeStructure. */ - isAmbientable(structure: T): structure is T & AmbientableNodeStructure { - switch (structure.kind) { + isAmbientable(structure: T): structure is T & AmbientableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.Class: case StructureKind.Enum: case StructureKind.FunctionOverload: @@ -241,8 +237,8 @@ export const Structure = { } }, /** Gets if the provided structure is a ExportableNodeStructure. */ - isExportable(structure: T): structure is T & ExportableNodeStructure { - switch (structure.kind) { + isExportable(structure: T): structure is T & ExportableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.Class: case StructureKind.Enum: case StructureKind.FunctionOverload: @@ -257,12 +253,12 @@ export const Structure = { } }, /** Gets if the provided structure is a ClassStaticBlockDeclarationStructure. */ - isClassStaticBlock(structure: Structure & { kind: StructureKind; }): structure is ClassStaticBlockDeclarationStructure { - return structure.kind === StructureKind.ClassStaticBlock; + isClassStaticBlock(structure: unknown): structure is ClassStaticBlockDeclarationStructure { + return (structure as any)?.kind === StructureKind.ClassStaticBlock; }, /** Gets if the provided structure is a StatementedNodeStructure. */ - isStatemented(structure: T): structure is T & StatementedNodeStructure { - switch (structure.kind) { + isStatemented(structure: T): structure is T & StatementedNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.ClassStaticBlock: case StructureKind.Constructor: case StructureKind.Function: @@ -277,12 +273,12 @@ export const Structure = { } }, /** Gets if the provided structure is a ConstructorDeclarationOverloadStructure. */ - isConstructorDeclarationOverload(structure: Structure & { kind: StructureKind; }): structure is ConstructorDeclarationOverloadStructure { - return structure.kind === StructureKind.ConstructorOverload; + isConstructorDeclarationOverload(structure: unknown): structure is ConstructorDeclarationOverloadStructure { + return (structure as any)?.kind === StructureKind.ConstructorOverload; }, /** Gets if the provided structure is a ScopedNodeStructure. */ - isScoped(structure: T): structure is T & ScopedNodeStructure { - switch (structure.kind) { + isScoped(structure: T): structure is T & ScopedNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.ConstructorOverload: case StructureKind.Constructor: case StructureKind.GetAccessor: @@ -296,12 +292,12 @@ export const Structure = { } }, /** Gets if the provided structure is a ConstructorDeclarationStructure. */ - isConstructor(structure: Structure & { kind: StructureKind; }): structure is ConstructorDeclarationStructure { - return structure.kind === StructureKind.Constructor; + isConstructor(structure: unknown): structure is ConstructorDeclarationStructure { + return (structure as any)?.kind === StructureKind.Constructor; }, /** Gets if the provided structure is a FunctionLikeDeclarationStructure. */ - isFunctionLike(structure: T): structure is T & FunctionLikeDeclarationStructure { - switch (structure.kind) { + isFunctionLike(structure: T): structure is T & FunctionLikeDeclarationStructure { + switch ((structure as any)?.kind) { case StructureKind.Constructor: case StructureKind.Function: case StructureKind.GetAccessor: @@ -313,20 +309,20 @@ export const Structure = { } }, /** Gets if the provided structure is a ConstructSignatureDeclarationStructure. */ - isConstructSignature(structure: Structure & { kind: StructureKind; }): structure is ConstructSignatureDeclarationStructure { - return structure.kind === StructureKind.ConstructSignature; + isConstructSignature(structure: unknown): structure is ConstructSignatureDeclarationStructure { + return (structure as any)?.kind === StructureKind.ConstructSignature; }, /** Gets if the provided structure is a DecoratorStructure. */ - isDecorator(structure: Structure & { kind: StructureKind; }): structure is DecoratorStructure { - return structure.kind === StructureKind.Decorator; + isDecorator(structure: unknown): structure is DecoratorStructure { + return (structure as any)?.kind === StructureKind.Decorator; }, /** Gets if the provided structure is a EnumDeclarationStructure. */ - isEnum(structure: Structure & { kind: StructureKind; }): structure is EnumDeclarationStructure { - return structure.kind === StructureKind.Enum; + isEnum(structure: unknown): structure is EnumDeclarationStructure { + return (structure as any)?.kind === StructureKind.Enum; }, /** Gets if the provided structure is a NamedNodeStructure. */ - isNamed(structure: T): structure is T & NamedNodeStructure { - switch (structure.kind) { + isNamed(structure: T): structure is T & NamedNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.Enum: case StructureKind.Interface: case StructureKind.JsxAttribute: @@ -339,12 +335,12 @@ export const Structure = { } }, /** Gets if the provided structure is a EnumMemberStructure. */ - isEnumMember(structure: Structure & { kind: StructureKind; }): structure is EnumMemberStructure { - return structure.kind === StructureKind.EnumMember; + isEnumMember(structure: unknown): structure is EnumMemberStructure { + return (structure as any)?.kind === StructureKind.EnumMember; }, /** Gets if the provided structure is a PropertyNamedNodeStructure. */ - isPropertyNamed(structure: T): structure is T & PropertyNamedNodeStructure { - switch (structure.kind) { + isPropertyNamed(structure: T): structure is T & PropertyNamedNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.EnumMember: case StructureKind.GetAccessor: case StructureKind.Method: @@ -359,8 +355,8 @@ export const Structure = { } }, /** Gets if the provided structure is a InitializerExpressionableNodeStructure. */ - isInitializerExpressionable(structure: T): structure is T & InitializerExpressionableNodeStructure { - switch (structure.kind) { + isInitializerExpressionable(structure: T): structure is T & InitializerExpressionableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.EnumMember: case StructureKind.Parameter: case StructureKind.Property: @@ -372,24 +368,24 @@ export const Structure = { } }, /** Gets if the provided structure is a ExportAssignmentStructure. */ - isExportAssignment(structure: Structure & { kind: StructureKind; }): structure is ExportAssignmentStructure { - return structure.kind === StructureKind.ExportAssignment; + isExportAssignment(structure: unknown): structure is ExportAssignmentStructure { + return (structure as any)?.kind === StructureKind.ExportAssignment; }, /** Gets if the provided structure is a ExportDeclarationStructure. */ - isExportDeclaration(structure: Structure & { kind: StructureKind; }): structure is ExportDeclarationStructure { - return structure.kind === StructureKind.ExportDeclaration; + isExportDeclaration(structure: unknown): structure is ExportDeclarationStructure { + return (structure as any)?.kind === StructureKind.ExportDeclaration; }, /** Gets if the provided structure is a ExportSpecifierStructure. */ - isExportSpecifier(structure: Structure & { kind: StructureKind; }): structure is ExportSpecifierStructure { - return structure.kind === StructureKind.ExportSpecifier; + isExportSpecifier(structure: unknown): structure is ExportSpecifierStructure { + return (structure as any)?.kind === StructureKind.ExportSpecifier; }, /** Gets if the provided structure is a FunctionDeclarationOverloadStructure. */ - isFunctionDeclarationOverload(structure: Structure & { kind: StructureKind; }): structure is FunctionDeclarationOverloadStructure { - return structure.kind === StructureKind.FunctionOverload; + isFunctionDeclarationOverload(structure: unknown): structure is FunctionDeclarationOverloadStructure { + return (structure as any)?.kind === StructureKind.FunctionOverload; }, /** Gets if the provided structure is a AsyncableNodeStructure. */ - isAsyncable(structure: T): structure is T & AsyncableNodeStructure { - switch (structure.kind) { + isAsyncable(structure: T): structure is T & AsyncableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.FunctionOverload: case StructureKind.Function: case StructureKind.MethodOverload: @@ -400,8 +396,8 @@ export const Structure = { } }, /** Gets if the provided structure is a GeneratorableNodeStructure. */ - isGeneratorable(structure: T): structure is T & GeneratorableNodeStructure { - switch (structure.kind) { + isGeneratorable(structure: T): structure is T & GeneratorableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.FunctionOverload: case StructureKind.Function: case StructureKind.MethodOverload: @@ -412,16 +408,16 @@ export const Structure = { } }, /** Gets if the provided structure is a FunctionDeclarationStructure. */ - isFunction(structure: Structure & { kind: StructureKind; }): structure is FunctionDeclarationStructure { - return structure.kind === StructureKind.Function; + isFunction(structure: unknown): structure is FunctionDeclarationStructure { + return (structure as any)?.kind === StructureKind.Function; }, /** Gets if the provided structure is a GetAccessorDeclarationStructure. */ - isGetAccessor(structure: Structure & { kind: StructureKind; }): structure is GetAccessorDeclarationStructure { - return structure.kind === StructureKind.GetAccessor; + isGetAccessor(structure: unknown): structure is GetAccessorDeclarationStructure { + return (structure as any)?.kind === StructureKind.GetAccessor; }, /** Gets if the provided structure is a StaticableNodeStructure. */ - isStaticable(structure: T): structure is T & StaticableNodeStructure { - switch (structure.kind) { + isStaticable(structure: T): structure is T & StaticableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.GetAccessor: case StructureKind.MethodOverload: case StructureKind.Method: @@ -433,20 +429,20 @@ export const Structure = { } }, /** Gets if the provided structure is a ImportDeclarationStructure. */ - isImportDeclaration(structure: Structure & { kind: StructureKind; }): structure is ImportDeclarationStructure { - return structure.kind === StructureKind.ImportDeclaration; + isImportDeclaration(structure: unknown): structure is ImportDeclarationStructure { + return (structure as any)?.kind === StructureKind.ImportDeclaration; }, /** Gets if the provided structure is a ImportSpecifierStructure. */ - isImportSpecifier(structure: Structure & { kind: StructureKind; }): structure is ImportSpecifierStructure { - return structure.kind === StructureKind.ImportSpecifier; + isImportSpecifier(structure: unknown): structure is ImportSpecifierStructure { + return (structure as any)?.kind === StructureKind.ImportSpecifier; }, /** Gets if the provided structure is a IndexSignatureDeclarationStructure. */ - isIndexSignature(structure: Structure & { kind: StructureKind; }): structure is IndexSignatureDeclarationStructure { - return structure.kind === StructureKind.IndexSignature; + isIndexSignature(structure: unknown): structure is IndexSignatureDeclarationStructure { + return (structure as any)?.kind === StructureKind.IndexSignature; }, /** Gets if the provided structure is a ReadonlyableNodeStructure. */ - isReadonlyable(structure: T): structure is T & ReadonlyableNodeStructure { - switch (structure.kind) { + isReadonlyable(structure: T): structure is T & ReadonlyableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.IndexSignature: case StructureKind.Parameter: case StructureKind.Property: @@ -457,56 +453,56 @@ export const Structure = { } }, /** Gets if the provided structure is a InterfaceDeclarationStructure. */ - isInterface(structure: Structure & { kind: StructureKind; }): structure is InterfaceDeclarationStructure { - return structure.kind === StructureKind.Interface; + isInterface(structure: unknown): structure is InterfaceDeclarationStructure { + return (structure as any)?.kind === StructureKind.Interface; }, /** Gets if the provided structure is a ExtendsClauseableNodeStructure. */ - isExtendsClauseable(structure: T): structure is T & ExtendsClauseableNodeStructure { - return structure.kind === StructureKind.Interface; + isExtendsClauseable(structure: T): structure is T & ExtendsClauseableNodeStructure { + return (structure as any)?.kind === StructureKind.Interface; }, /** Gets if the provided structure is a TypeElementMemberedNodeStructure. */ - isTypeElementMembered(structure: T): structure is T & TypeElementMemberedNodeStructure { - return structure.kind === StructureKind.Interface; + isTypeElementMembered(structure: T): structure is T & TypeElementMemberedNodeStructure { + return (structure as any)?.kind === StructureKind.Interface; }, /** Gets if the provided structure is a JSDocStructure. */ - isJSDoc(structure: Structure & { kind: StructureKind; }): structure is JSDocStructure { - return structure.kind === StructureKind.JSDoc; + isJSDoc(structure: unknown): structure is JSDocStructure { + return (structure as any)?.kind === StructureKind.JSDoc; }, /** Gets if the provided structure is a JSDocTagStructure. */ - isJSDocTag(structure: Structure & { kind: StructureKind; }): structure is JSDocTagStructure { - return structure.kind === StructureKind.JSDocTag; + isJSDocTag(structure: unknown): structure is JSDocTagStructure { + return (structure as any)?.kind === StructureKind.JSDocTag; }, /** Gets if the provided structure is a JsxAttributeStructure. */ - isJsxAttribute(structure: Structure & { kind: StructureKind; }): structure is JsxAttributeStructure { - return structure.kind === StructureKind.JsxAttribute; + isJsxAttribute(structure: unknown): structure is JsxAttributeStructure { + return (structure as any)?.kind === StructureKind.JsxAttribute; }, /** Gets if the provided structure is a JsxElementStructure. */ - isJsxElement(structure: Structure & { kind: StructureKind; }): structure is JsxElementStructure { - return structure.kind === StructureKind.JsxElement; + isJsxElement(structure: unknown): structure is JsxElementStructure { + return (structure as any)?.kind === StructureKind.JsxElement; }, /** Gets if the provided structure is a JsxSelfClosingElementStructure. */ - isJsxSelfClosingElement(structure: Structure & { kind: StructureKind; }): structure is JsxSelfClosingElementStructure { - return structure.kind === StructureKind.JsxSelfClosingElement; + isJsxSelfClosingElement(structure: unknown): structure is JsxSelfClosingElementStructure { + return (structure as any)?.kind === StructureKind.JsxSelfClosingElement; }, /** Gets if the provided structure is a JsxTagNamedNodeStructure. */ - isJsxTagNamed(structure: T): structure is T & JsxTagNamedNodeStructure { - return structure.kind === StructureKind.JsxSelfClosingElement; + isJsxTagNamed(structure: T): structure is T & JsxTagNamedNodeStructure { + return (structure as any)?.kind === StructureKind.JsxSelfClosingElement; }, /** Gets if the provided structure is a JsxAttributedNodeStructure. */ - isJsxAttributed(structure: T): structure is T & JsxAttributedNodeStructure { - return structure.kind === StructureKind.JsxSelfClosingElement; + isJsxAttributed(structure: T): structure is T & JsxAttributedNodeStructure { + return (structure as any)?.kind === StructureKind.JsxSelfClosingElement; }, /** Gets if the provided structure is a JsxSpreadAttributeStructure. */ - isJsxSpreadAttribute(structure: Structure & { kind: StructureKind; }): structure is JsxSpreadAttributeStructure { - return structure.kind === StructureKind.JsxSpreadAttribute; + isJsxSpreadAttribute(structure: unknown): structure is JsxSpreadAttributeStructure { + return (structure as any)?.kind === StructureKind.JsxSpreadAttribute; }, /** Gets if the provided structure is a MethodDeclarationOverloadStructure. */ - isMethodDeclarationOverload(structure: Structure & { kind: StructureKind; }): structure is MethodDeclarationOverloadStructure { - return structure.kind === StructureKind.MethodOverload; + isMethodDeclarationOverload(structure: unknown): structure is MethodDeclarationOverloadStructure { + return (structure as any)?.kind === StructureKind.MethodOverload; }, /** Gets if the provided structure is a QuestionTokenableNodeStructure. */ - isQuestionTokenable(structure: T): structure is T & QuestionTokenableNodeStructure { - switch (structure.kind) { + isQuestionTokenable(structure: T): structure is T & QuestionTokenableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.MethodOverload: case StructureKind.Method: case StructureKind.MethodSignature: @@ -519,8 +515,8 @@ export const Structure = { } }, /** Gets if the provided structure is a OverrideableNodeStructure. */ - isOverrideable(structure: T): structure is T & OverrideableNodeStructure { - switch (structure.kind) { + isOverrideable(structure: T): structure is T & OverrideableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.MethodOverload: case StructureKind.Method: case StructureKind.Parameter: @@ -531,28 +527,28 @@ export const Structure = { } }, /** Gets if the provided structure is a MethodDeclarationStructure. */ - isMethod(structure: Structure & { kind: StructureKind; }): structure is MethodDeclarationStructure { - return structure.kind === StructureKind.Method; + isMethod(structure: unknown): structure is MethodDeclarationStructure { + return (structure as any)?.kind === StructureKind.Method; }, /** Gets if the provided structure is a MethodSignatureStructure. */ - isMethodSignature(structure: Structure & { kind: StructureKind; }): structure is MethodSignatureStructure { - return structure.kind === StructureKind.MethodSignature; + isMethodSignature(structure: unknown): structure is MethodSignatureStructure { + return (structure as any)?.kind === StructureKind.MethodSignature; }, /** Gets if the provided structure is a ModuleDeclarationStructure. */ - isModule(structure: Structure & { kind: StructureKind; }): structure is ModuleDeclarationStructure { - return structure.kind === StructureKind.Module; + isModule(structure: unknown): structure is ModuleDeclarationStructure { + return (structure as any)?.kind === StructureKind.Module; }, /** Gets if the provided structure is a ModuleNamedNodeStructure. */ - isModuleNamed(structure: T): structure is T & ModuleNamedNodeStructure { - return structure.kind === StructureKind.Module; + isModuleNamed(structure: T): structure is T & ModuleNamedNodeStructure { + return (structure as any)?.kind === StructureKind.Module; }, /** Gets if the provided structure is a ParameterDeclarationStructure. */ - isParameter(structure: Structure & { kind: StructureKind; }): structure is ParameterDeclarationStructure { - return structure.kind === StructureKind.Parameter; + isParameter(structure: unknown): structure is ParameterDeclarationStructure { + return (structure as any)?.kind === StructureKind.Parameter; }, /** Gets if the provided structure is a BindingNamedNodeStructure. */ - isBindingNamed(structure: T): structure is T & BindingNamedNodeStructure { - switch (structure.kind) { + isBindingNamed(structure: T): structure is T & BindingNamedNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.Parameter: case StructureKind.VariableDeclaration: return true; @@ -561,8 +557,8 @@ export const Structure = { } }, /** Gets if the provided structure is a TypedNodeStructure. */ - isTyped(structure: T): structure is T & TypedNodeStructure { - switch (structure.kind) { + isTyped(structure: T): structure is T & TypedNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.Parameter: case StructureKind.Property: case StructureKind.PropertySignature: @@ -574,20 +570,20 @@ export const Structure = { } }, /** Gets if the provided structure is a ScopeableNodeStructure. */ - isScopeable(structure: T): structure is T & ScopeableNodeStructure { - return structure.kind === StructureKind.Parameter; + isScopeable(structure: T): structure is T & ScopeableNodeStructure { + return (structure as any)?.kind === StructureKind.Parameter; }, /** Gets if the provided structure is a PropertyAssignmentStructure. */ - isPropertyAssignment(structure: Structure & { kind: StructureKind; }): structure is PropertyAssignmentStructure { - return structure.kind === StructureKind.PropertyAssignment; + isPropertyAssignment(structure: unknown): structure is PropertyAssignmentStructure { + return (structure as any)?.kind === StructureKind.PropertyAssignment; }, /** Gets if the provided structure is a PropertyDeclarationStructure. */ - isProperty(structure: Structure & { kind: StructureKind; }): structure is PropertyDeclarationStructure { - return structure.kind === StructureKind.Property; + isProperty(structure: unknown): structure is PropertyDeclarationStructure { + return (structure as any)?.kind === StructureKind.Property; }, /** Gets if the provided structure is a ExclamationTokenableNodeStructure. */ - isExclamationTokenable(structure: T): structure is T & ExclamationTokenableNodeStructure { - switch (structure.kind) { + isExclamationTokenable(structure: T): structure is T & ExclamationTokenableNodeStructure { + switch ((structure as any)?.kind) { case StructureKind.Property: case StructureKind.VariableDeclaration: return true; @@ -596,43 +592,43 @@ export const Structure = { } }, /** Gets if the provided structure is a PropertySignatureStructure. */ - isPropertySignature(structure: Structure & { kind: StructureKind; }): structure is PropertySignatureStructure { - return structure.kind === StructureKind.PropertySignature; + isPropertySignature(structure: unknown): structure is PropertySignatureStructure { + return (structure as any)?.kind === StructureKind.PropertySignature; }, /** Gets if the provided structure is a SetAccessorDeclarationStructure. */ - isSetAccessor(structure: Structure & { kind: StructureKind; }): structure is SetAccessorDeclarationStructure { - return structure.kind === StructureKind.SetAccessor; + isSetAccessor(structure: unknown): structure is SetAccessorDeclarationStructure { + return (structure as any)?.kind === StructureKind.SetAccessor; }, /** Gets if the provided structure is a ShorthandPropertyAssignmentStructure. */ - isShorthandPropertyAssignment(structure: Structure & { kind: StructureKind; }): structure is ShorthandPropertyAssignmentStructure { - return structure.kind === StructureKind.ShorthandPropertyAssignment; + isShorthandPropertyAssignment(structure: unknown): structure is ShorthandPropertyAssignmentStructure { + return (structure as any)?.kind === StructureKind.ShorthandPropertyAssignment; }, /** Gets if the provided structure is a SourceFileStructure. */ - isSourceFile(structure: Structure & { kind: StructureKind; }): structure is SourceFileStructure { - return structure.kind === StructureKind.SourceFile; + isSourceFile(structure: unknown): structure is SourceFileStructure { + return (structure as any)?.kind === StructureKind.SourceFile; }, /** Gets if the provided structure is a SpreadAssignmentStructure. */ - isSpreadAssignment(structure: Structure & { kind: StructureKind; }): structure is SpreadAssignmentStructure { - return structure.kind === StructureKind.SpreadAssignment; + isSpreadAssignment(structure: unknown): structure is SpreadAssignmentStructure { + return (structure as any)?.kind === StructureKind.SpreadAssignment; }, /** Gets if the provided structure is a ExpressionedNodeStructure. */ - isExpressioned(structure: T): structure is T & ExpressionedNodeStructure { - return structure.kind === StructureKind.SpreadAssignment; + isExpressioned(structure: T): structure is T & ExpressionedNodeStructure { + return (structure as any)?.kind === StructureKind.SpreadAssignment; }, /** Gets if the provided structure is a TypeAliasDeclarationStructure. */ - isTypeAlias(structure: Structure & { kind: StructureKind; }): structure is TypeAliasDeclarationStructure { - return structure.kind === StructureKind.TypeAlias; + isTypeAlias(structure: unknown): structure is TypeAliasDeclarationStructure { + return (structure as any)?.kind === StructureKind.TypeAlias; }, /** Gets if the provided structure is a TypeParameterDeclarationStructure. */ - isTypeParameter(structure: Structure & { kind: StructureKind; }): structure is TypeParameterDeclarationStructure { - return structure.kind === StructureKind.TypeParameter; + isTypeParameter(structure: unknown): structure is TypeParameterDeclarationStructure { + return (structure as any)?.kind === StructureKind.TypeParameter; }, /** Gets if the provided structure is a VariableDeclarationStructure. */ - isVariableDeclaration(structure: Structure & { kind: StructureKind; }): structure is VariableDeclarationStructure { - return structure.kind === StructureKind.VariableDeclaration; + isVariableDeclaration(structure: unknown): structure is VariableDeclarationStructure { + return (structure as any)?.kind === StructureKind.VariableDeclaration; }, /** Gets if the provided structure is a VariableStatementStructure. */ - isVariableStatement(structure: Structure & { kind: StructureKind; }): structure is VariableStatementStructure { - return structure.kind === StructureKind.VariableStatement; + isVariableStatement(structure: unknown): structure is VariableStatementStructure { + return (structure as any)?.kind === StructureKind.VariableStatement; } } as const; diff --git a/packages/ts-morph/src/structures/class/ClassDeclarationStructure.ts b/packages/ts-morph/src/structures/class/ClassDeclarationStructure.ts index e4448b657..d50cb0cc7 100644 --- a/packages/ts-morph/src/structures/class/ClassDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/class/ClassDeclarationStructure.ts @@ -1,5 +1,5 @@ import { AmbientableNodeStructure, ExportableNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { ClassLikeDeclarationBaseStructure } from "./base"; diff --git a/packages/ts-morph/src/structures/class/ClassStaticBlockDeclarationStructure.ts b/packages/ts-morph/src/structures/class/ClassStaticBlockDeclarationStructure.ts index 3fa7d42ab..765cbe65b 100644 --- a/packages/ts-morph/src/structures/class/ClassStaticBlockDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/class/ClassStaticBlockDeclarationStructure.ts @@ -1,6 +1,6 @@ import { JSDocableNodeStructure } from "../base"; import { StatementedNodeStructure } from "../statement"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface ClassStaticBlockDeclarationStructure diff --git a/packages/ts-morph/src/structures/class/ConstructorDeclarationStructure.ts b/packages/ts-morph/src/structures/class/ConstructorDeclarationStructure.ts index 4f3b8aa3d..73be28565 100644 --- a/packages/ts-morph/src/structures/class/ConstructorDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/class/ConstructorDeclarationStructure.ts @@ -1,6 +1,6 @@ import { JSDocableNodeStructure, ScopedNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure } from "../base"; import { FunctionLikeDeclarationStructure } from "../function"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { OptionalKind } from "../types"; diff --git a/packages/ts-morph/src/structures/class/GetAccessorDeclarationStructure.ts b/packages/ts-morph/src/structures/class/GetAccessorDeclarationStructure.ts index a37321e3c..33c3a907e 100644 --- a/packages/ts-morph/src/structures/class/GetAccessorDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/class/GetAccessorDeclarationStructure.ts @@ -1,6 +1,6 @@ import { AbstractableNodeStructure, DecoratableNodeStructure, PropertyNamedNodeStructure, ScopedNodeStructure, StaticableNodeStructure } from "../base"; import { FunctionLikeDeclarationStructure } from "../function"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface GetAccessorDeclarationStructure diff --git a/packages/ts-morph/src/structures/class/MethodDeclarationStructure.ts b/packages/ts-morph/src/structures/class/MethodDeclarationStructure.ts index db62e957e..e739648e3 100644 --- a/packages/ts-morph/src/structures/class/MethodDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/class/MethodDeclarationStructure.ts @@ -13,7 +13,7 @@ import { TypeParameteredNodeStructure, } from "../base"; import { FunctionLikeDeclarationStructure } from "../function"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { OptionalKind } from "../types"; diff --git a/packages/ts-morph/src/structures/class/PropertyDeclarationStructure.ts b/packages/ts-morph/src/structures/class/PropertyDeclarationStructure.ts index 0dd5e211f..b0bd923b4 100644 --- a/packages/ts-morph/src/structures/class/PropertyDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/class/PropertyDeclarationStructure.ts @@ -13,7 +13,7 @@ import { StaticableNodeStructure, TypedNodeStructure, } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface PropertyDeclarationStructure diff --git a/packages/ts-morph/src/structures/class/SetAccessorDeclarationStructure.ts b/packages/ts-morph/src/structures/class/SetAccessorDeclarationStructure.ts index b5e3e6e38..2261f74a7 100644 --- a/packages/ts-morph/src/structures/class/SetAccessorDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/class/SetAccessorDeclarationStructure.ts @@ -1,6 +1,6 @@ import { AbstractableNodeStructure, DecoratableNodeStructure, PropertyNamedNodeStructure, ScopedNodeStructure, StaticableNodeStructure } from "../base"; import { FunctionLikeDeclarationStructure } from "../function"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface SetAccessorDeclarationStructure diff --git a/packages/ts-morph/src/structures/decorator/DecoratorStructure.ts b/packages/ts-morph/src/structures/decorator/DecoratorStructure.ts index ae05419d7..8d622c608 100644 --- a/packages/ts-morph/src/structures/decorator/DecoratorStructure.ts +++ b/packages/ts-morph/src/structures/decorator/DecoratorStructure.ts @@ -1,5 +1,5 @@ import { WriterFunction } from "../../types"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface DecoratorStructure extends Structure, DecoratorSpecificStructure { diff --git a/packages/ts-morph/src/structures/doc/JSDocStructure.ts b/packages/ts-morph/src/structures/doc/JSDocStructure.ts index cb84a2041..9773cfcc9 100644 --- a/packages/ts-morph/src/structures/doc/JSDocStructure.ts +++ b/packages/ts-morph/src/structures/doc/JSDocStructure.ts @@ -1,5 +1,5 @@ import { WriterFunction } from "../../types"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { OptionalKind } from "../types"; import { JSDocTagStructure } from "./JSDocTagStructure"; diff --git a/packages/ts-morph/src/structures/doc/JSDocTagStructure.ts b/packages/ts-morph/src/structures/doc/JSDocTagStructure.ts index a985f44de..9b9191601 100644 --- a/packages/ts-morph/src/structures/doc/JSDocTagStructure.ts +++ b/packages/ts-morph/src/structures/doc/JSDocTagStructure.ts @@ -1,5 +1,5 @@ import { WriterFunction } from "../../types"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface JSDocTagStructure extends Structure, JSDocTagSpecificStructure { diff --git a/packages/ts-morph/src/structures/enum/EnumDeclarationStructure.ts b/packages/ts-morph/src/structures/enum/EnumDeclarationStructure.ts index 9809abecb..3ebc22a42 100644 --- a/packages/ts-morph/src/structures/enum/EnumDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/enum/EnumDeclarationStructure.ts @@ -1,5 +1,5 @@ import { AmbientableNodeStructure, ExportableNodeStructure, JSDocableNodeStructure, NamedNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { OptionalKind } from "../types"; import { EnumMemberStructure } from "./EnumMemberStructure"; diff --git a/packages/ts-morph/src/structures/enum/EnumMemberStructure.ts b/packages/ts-morph/src/structures/enum/EnumMemberStructure.ts index 1f74e6483..a104b4008 100644 --- a/packages/ts-morph/src/structures/enum/EnumMemberStructure.ts +++ b/packages/ts-morph/src/structures/enum/EnumMemberStructure.ts @@ -1,5 +1,5 @@ import { InitializerExpressionableNodeStructure, JSDocableNodeStructure, PropertyNamedNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface EnumMemberStructure diff --git a/packages/ts-morph/src/structures/expression/object/PropertyAssignmentStructure.ts b/packages/ts-morph/src/structures/expression/object/PropertyAssignmentStructure.ts index d24363fa1..05f53feb9 100644 --- a/packages/ts-morph/src/structures/expression/object/PropertyAssignmentStructure.ts +++ b/packages/ts-morph/src/structures/expression/object/PropertyAssignmentStructure.ts @@ -1,6 +1,6 @@ import { WriterFunction } from "../../../types"; import { PropertyNamedNodeStructure } from "../../base"; -import { KindedStructure, Structure } from "../../Structure"; +import { KindedStructure, Structure } from "../../Structure.generated"; import { StructureKind } from "../../StructureKind"; export interface PropertyAssignmentStructure extends Structure, PropertyAssignmentSpecificStructure, PropertyNamedNodeStructure { diff --git a/packages/ts-morph/src/structures/expression/object/ShorthandPropertyAssignmentStructure.ts b/packages/ts-morph/src/structures/expression/object/ShorthandPropertyAssignmentStructure.ts index c7f888219..dd59c1267 100644 --- a/packages/ts-morph/src/structures/expression/object/ShorthandPropertyAssignmentStructure.ts +++ b/packages/ts-morph/src/structures/expression/object/ShorthandPropertyAssignmentStructure.ts @@ -1,5 +1,5 @@ import { NamedNodeStructure } from "../../base"; -import { KindedStructure, Structure } from "../../Structure"; +import { KindedStructure, Structure } from "../../Structure.generated"; import { StructureKind } from "../../StructureKind"; export interface ShorthandPropertyAssignmentStructure extends Structure, ShorthandPropertyAssignmentSpecificStructure, NamedNodeStructure { diff --git a/packages/ts-morph/src/structures/expression/object/SpreadAssignmentStructure.ts b/packages/ts-morph/src/structures/expression/object/SpreadAssignmentStructure.ts index 3fa05371d..746075883 100644 --- a/packages/ts-morph/src/structures/expression/object/SpreadAssignmentStructure.ts +++ b/packages/ts-morph/src/structures/expression/object/SpreadAssignmentStructure.ts @@ -1,4 +1,4 @@ -import { KindedStructure, Structure } from "../../Structure"; +import { KindedStructure, Structure } from "../../Structure.generated"; import { StructureKind } from "../../StructureKind"; import { ExpressionedNodeStructure } from "../expressioned"; diff --git a/packages/ts-morph/src/structures/function/FunctionDeclarationStructure.ts b/packages/ts-morph/src/structures/function/FunctionDeclarationStructure.ts index 7daaf356d..2e5b4f1d2 100644 --- a/packages/ts-morph/src/structures/function/FunctionDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/function/FunctionDeclarationStructure.ts @@ -8,7 +8,7 @@ import { SignaturedDeclarationStructure, TypeParameteredNodeStructure, } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { OptionalKind } from "../types"; import { FunctionLikeDeclarationStructure } from "./FunctionLikeDeclarationStructure"; diff --git a/packages/ts-morph/src/structures/function/ParameterDeclarationStructure.ts b/packages/ts-morph/src/structures/function/ParameterDeclarationStructure.ts index 14da32513..9d1f3ab0e 100644 --- a/packages/ts-morph/src/structures/function/ParameterDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/function/ParameterDeclarationStructure.ts @@ -8,7 +8,7 @@ import { ScopeableNodeStructure, TypedNodeStructure, } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface ParameterDeclarationStructure diff --git a/packages/ts-morph/src/structures/index.ts b/packages/ts-morph/src/structures/index.ts index 647a78fb3..0ae7c9017 100644 --- a/packages/ts-morph/src/structures/index.ts +++ b/packages/ts-morph/src/structures/index.ts @@ -10,7 +10,7 @@ export * from "./interface"; export * from "./jsx"; export * from "./module"; export * from "./statement"; -export * from "./Structure"; +export * from "./Structure.generated"; export * from "./StructureKind"; export * from "./type"; export * from "./types"; diff --git a/packages/ts-morph/src/structures/interface/CallSignatureDeclarationStructure.ts b/packages/ts-morph/src/structures/interface/CallSignatureDeclarationStructure.ts index 47f045363..02c23dc35 100644 --- a/packages/ts-morph/src/structures/interface/CallSignatureDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/interface/CallSignatureDeclarationStructure.ts @@ -1,5 +1,5 @@ import { JSDocableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface CallSignatureDeclarationStructure diff --git a/packages/ts-morph/src/structures/interface/ConstructSignatureDeclarationStructure.ts b/packages/ts-morph/src/structures/interface/ConstructSignatureDeclarationStructure.ts index fd6f41fcc..162c9fa9c 100644 --- a/packages/ts-morph/src/structures/interface/ConstructSignatureDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/interface/ConstructSignatureDeclarationStructure.ts @@ -1,5 +1,5 @@ import { JSDocableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface ConstructSignatureDeclarationStructure diff --git a/packages/ts-morph/src/structures/interface/IndexSignatureDeclarationStructure.ts b/packages/ts-morph/src/structures/interface/IndexSignatureDeclarationStructure.ts index 382211068..28ea70cc4 100644 --- a/packages/ts-morph/src/structures/interface/IndexSignatureDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/interface/IndexSignatureDeclarationStructure.ts @@ -1,5 +1,5 @@ import { JSDocableNodeStructure, ReadonlyableNodeStructure, ReturnTypedNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface IndexSignatureDeclarationStructure diff --git a/packages/ts-morph/src/structures/interface/InterfaceDeclarationStructure.ts b/packages/ts-morph/src/structures/interface/InterfaceDeclarationStructure.ts index 024280ce2..05fe5b85b 100644 --- a/packages/ts-morph/src/structures/interface/InterfaceDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/interface/InterfaceDeclarationStructure.ts @@ -7,7 +7,7 @@ import { TypeElementMemberedNodeStructure, TypeParameteredNodeStructure, } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface InterfaceDeclarationStructure diff --git a/packages/ts-morph/src/structures/interface/MethodSignatureStructure.ts b/packages/ts-morph/src/structures/interface/MethodSignatureStructure.ts index 5e9952ba0..dfad4155f 100644 --- a/packages/ts-morph/src/structures/interface/MethodSignatureStructure.ts +++ b/packages/ts-morph/src/structures/interface/MethodSignatureStructure.ts @@ -5,7 +5,7 @@ import { SignaturedDeclarationStructure, TypeParameteredNodeStructure, } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface MethodSignatureStructure diff --git a/packages/ts-morph/src/structures/interface/PropertySignatureStructure.ts b/packages/ts-morph/src/structures/interface/PropertySignatureStructure.ts index 578fd3e36..c85b4d819 100644 --- a/packages/ts-morph/src/structures/interface/PropertySignatureStructure.ts +++ b/packages/ts-morph/src/structures/interface/PropertySignatureStructure.ts @@ -6,7 +6,7 @@ import { ReadonlyableNodeStructure, TypedNodeStructure, } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface PropertySignatureStructure diff --git a/packages/ts-morph/src/structures/jsx/JsxAttributeStructure.ts b/packages/ts-morph/src/structures/jsx/JsxAttributeStructure.ts index 63c03fe1d..c539b5c21 100644 --- a/packages/ts-morph/src/structures/jsx/JsxAttributeStructure.ts +++ b/packages/ts-morph/src/structures/jsx/JsxAttributeStructure.ts @@ -1,5 +1,5 @@ import { NamedNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface JsxAttributeStructure extends Structure, JsxAttributeSpecificStructure, NamedNodeStructure { diff --git a/packages/ts-morph/src/structures/jsx/JsxElementStructure.ts b/packages/ts-morph/src/structures/jsx/JsxElementStructure.ts index bd7d94832..06cfc6750 100644 --- a/packages/ts-morph/src/structures/jsx/JsxElementStructure.ts +++ b/packages/ts-morph/src/structures/jsx/JsxElementStructure.ts @@ -1,4 +1,4 @@ -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { OptionalKind } from "../types"; import { JsxAttributeStructure } from "./JsxAttributeStructure"; diff --git a/packages/ts-morph/src/structures/jsx/JsxSelfClosingElementStructure.ts b/packages/ts-morph/src/structures/jsx/JsxSelfClosingElementStructure.ts index 26f01e1fb..4b85a9d89 100644 --- a/packages/ts-morph/src/structures/jsx/JsxSelfClosingElementStructure.ts +++ b/packages/ts-morph/src/structures/jsx/JsxSelfClosingElementStructure.ts @@ -1,4 +1,4 @@ -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { JsxAttributedNodeStructure, JsxTagNamedNodeStructure } from "./base"; diff --git a/packages/ts-morph/src/structures/jsx/JsxSpreadAttributeStructure.ts b/packages/ts-morph/src/structures/jsx/JsxSpreadAttributeStructure.ts index 48cbb3ebf..12c872eeb 100644 --- a/packages/ts-morph/src/structures/jsx/JsxSpreadAttributeStructure.ts +++ b/packages/ts-morph/src/structures/jsx/JsxSpreadAttributeStructure.ts @@ -1,4 +1,4 @@ -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface JsxSpreadAttributeStructure extends Structure, JsxSpreadAttributeSpecificStructure { diff --git a/packages/ts-morph/src/structures/module/AssertEntryStructure.ts b/packages/ts-morph/src/structures/module/AssertEntryStructure.ts index 5f4411ebc..7fb8b4577 100644 --- a/packages/ts-morph/src/structures/module/AssertEntryStructure.ts +++ b/packages/ts-morph/src/structures/module/AssertEntryStructure.ts @@ -1,5 +1,5 @@ import { AssertionKeyNamedNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface AssertEntryStructure extends Structure, AssertEntryStructureSpecificStructure, AssertionKeyNamedNodeStructure { diff --git a/packages/ts-morph/src/structures/module/ExportAssignmentStructure.ts b/packages/ts-morph/src/structures/module/ExportAssignmentStructure.ts index 47e9a3bb1..eb08b6f6c 100644 --- a/packages/ts-morph/src/structures/module/ExportAssignmentStructure.ts +++ b/packages/ts-morph/src/structures/module/ExportAssignmentStructure.ts @@ -1,5 +1,5 @@ import { WriterFunction } from "../../types"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface ExportAssignmentStructure extends Structure, ExportAssignmentSpecificStructure { diff --git a/packages/ts-morph/src/structures/module/ExportDeclarationStructure.ts b/packages/ts-morph/src/structures/module/ExportDeclarationStructure.ts index b8f1cd3f8..b967bb37b 100644 --- a/packages/ts-morph/src/structures/module/ExportDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/module/ExportDeclarationStructure.ts @@ -1,5 +1,5 @@ import { WriterFunction } from "../../types"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { OptionalKind } from "../types"; import { AssertEntryStructure } from "./AssertEntryStructure"; diff --git a/packages/ts-morph/src/structures/module/ExportSpecifierStructure.ts b/packages/ts-morph/src/structures/module/ExportSpecifierStructure.ts index 08188fe39..058e0a30c 100644 --- a/packages/ts-morph/src/structures/module/ExportSpecifierStructure.ts +++ b/packages/ts-morph/src/structures/module/ExportSpecifierStructure.ts @@ -1,4 +1,4 @@ -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface ExportSpecifierStructure extends Structure, ExportSpecifierSpecificStructure { diff --git a/packages/ts-morph/src/structures/module/ImportDeclarationStructure.ts b/packages/ts-morph/src/structures/module/ImportDeclarationStructure.ts index 9f0c10d86..4b6e9628c 100644 --- a/packages/ts-morph/src/structures/module/ImportDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/module/ImportDeclarationStructure.ts @@ -1,5 +1,5 @@ import { WriterFunction } from "../../types"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { OptionalKind } from "../types"; import { AssertEntryStructure } from "./AssertEntryStructure"; diff --git a/packages/ts-morph/src/structures/module/ImportSpecifierStructure.ts b/packages/ts-morph/src/structures/module/ImportSpecifierStructure.ts index 90b7b1ecd..b7d9eff79 100644 --- a/packages/ts-morph/src/structures/module/ImportSpecifierStructure.ts +++ b/packages/ts-morph/src/structures/module/ImportSpecifierStructure.ts @@ -1,4 +1,4 @@ -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface ImportSpecifierStructure extends Structure, ImportSpecifierSpecificStructure { diff --git a/packages/ts-morph/src/structures/module/ModuleDeclarationStructure.ts b/packages/ts-morph/src/structures/module/ModuleDeclarationStructure.ts index 050da9ee2..3d8ca194f 100644 --- a/packages/ts-morph/src/structures/module/ModuleDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/module/ModuleDeclarationStructure.ts @@ -1,7 +1,7 @@ import { ModuleDeclarationKind } from "../../compiler"; import { AmbientableNodeStructure, ExportableNodeStructure, JSDocableNodeStructure, ModuleNamedNodeStructure } from "../base"; import { StatementedNodeStructure } from "../statement"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface ModuleDeclarationStructure diff --git a/packages/ts-morph/src/structures/module/SourceFileStructure.ts b/packages/ts-morph/src/structures/module/SourceFileStructure.ts index b107e6521..84ac05e9a 100644 --- a/packages/ts-morph/src/structures/module/SourceFileStructure.ts +++ b/packages/ts-morph/src/structures/module/SourceFileStructure.ts @@ -1,5 +1,5 @@ import { StatementedNodeStructure } from "../statement"; -import { Structure } from "../Structure"; +import { Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface SourceFileStructure extends Structure, SourceFileSpecificStructure, StatementedNodeStructure { diff --git a/packages/ts-morph/src/structures/statement/VariableDeclarationStructure.ts b/packages/ts-morph/src/structures/statement/VariableDeclarationStructure.ts index 0408b930c..ad038b4c9 100644 --- a/packages/ts-morph/src/structures/statement/VariableDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/statement/VariableDeclarationStructure.ts @@ -1,5 +1,5 @@ import { BindingNamedNodeStructure, ExclamationTokenableNodeStructure, InitializerExpressionableNodeStructure, TypedNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface VariableDeclarationStructure diff --git a/packages/ts-morph/src/structures/statement/VariableStatementStructure.ts b/packages/ts-morph/src/structures/statement/VariableStatementStructure.ts index d53928af5..2b03fedf2 100644 --- a/packages/ts-morph/src/structures/statement/VariableStatementStructure.ts +++ b/packages/ts-morph/src/structures/statement/VariableStatementStructure.ts @@ -1,6 +1,6 @@ import { VariableDeclarationKind } from "../../compiler"; import { AmbientableNodeStructure, ExportableNodeStructure, JSDocableNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; import { OptionalKind } from "../types"; import { VariableDeclarationStructure } from "./VariableDeclarationStructure"; diff --git a/packages/ts-morph/src/structures/type/TypeAliasDeclarationStructure.ts b/packages/ts-morph/src/structures/type/TypeAliasDeclarationStructure.ts index cada0c114..295c793d5 100644 --- a/packages/ts-morph/src/structures/type/TypeAliasDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/type/TypeAliasDeclarationStructure.ts @@ -7,7 +7,7 @@ import { TypedNodeStructure, TypeParameteredNodeStructure, } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface TypeAliasDeclarationStructure diff --git a/packages/ts-morph/src/structures/type/TypeParameterDeclarationStructure.ts b/packages/ts-morph/src/structures/type/TypeParameterDeclarationStructure.ts index d4a81f4c9..adb9aba98 100644 --- a/packages/ts-morph/src/structures/type/TypeParameterDeclarationStructure.ts +++ b/packages/ts-morph/src/structures/type/TypeParameterDeclarationStructure.ts @@ -1,6 +1,6 @@ import { WriterFunction } from "../../types"; import { NamedNodeStructure } from "../base"; -import { KindedStructure, Structure } from "../Structure"; +import { KindedStructure, Structure } from "../Structure.generated"; import { StructureKind } from "../StructureKind"; export interface TypeParameterDeclarationStructure extends Structure, TypeParameterDeclarationSpecificStructure, NamedNodeStructure {