Skip to content

Commit

Permalink
feat: #553 - VariableDeclaration now has read exportable methods like…
Browse files Browse the repository at this point in the history
… isDefaultExport().
  • Loading branch information
dsherret committed Mar 2, 2019
1 parent bba33ee commit 0991e96
Show file tree
Hide file tree
Showing 12 changed files with 613 additions and 379 deletions.
42 changes: 27 additions & 15 deletions lib/ts-morph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,11 @@ export declare class TypeGuards {
* @param node - Node to check.
*/
static isExportDeclaration(node: Node): node is ExportDeclaration;
/**
* Gets if the node is an ExportGetableNode.
* @param node - Node to check.
*/
static isExportGetableNode(node: Node): node is ExportGetableNode & ExportGetableNodeExtensionType;
/**
* Gets if the node is an ExportSpecifier.
* @param node - Node to check.
Expand Down Expand Up @@ -2186,7 +2191,26 @@ declare type ExclamationTokenableNodeExtensionType = Node<ts.Node & {

export declare function ExportableNode<T extends Constructor<ExportableNodeExtensionType>>(Base: T): Constructor<ExportableNode> & T;

export interface ExportableNode {
export interface ExportableNode extends ExportGetableNode {
/**
* Sets if this node is a default export of a file.
* @param value - If it should be a default export or not.
*/
setIsDefaultExport(value: boolean): this;
/**
* Sets if the node is exported.
*
* Note: Will remove the default keyword if set.
* @param value - If it should be exported or not.
*/
setIsExported(value: boolean): this;
}

declare type ExportableNodeExtensionType = Node & ModifierableNode;

export declare function ExportGetableNode<T extends Constructor<ExportGetableNodeExtensionType>>(Base: T): Constructor<ExportGetableNode> & T;

export interface ExportGetableNode {
/**
* If the node has the export keyword.
*/
Expand Down Expand Up @@ -2223,21 +2247,9 @@ export interface ExportableNode {
* Gets if this node is a named export of a file.
*/
isNamedExport(): boolean;
/**
* Sets if this node is a default export of a file.
* @param value - If it should be a default export or not.
*/
setIsDefaultExport(value: boolean): this;
/**
* Sets if the node is exported.
*
* Note: Will remove the default keyword if set.
* @param value - If it should be exported or not.
*/
setIsExported(value: boolean): this;
}

declare type ExportableNodeExtensionType = Node & ModifierableNode;
declare type ExportGetableNodeExtensionType = Node;

export declare function ExtendsClauseableNode<T extends Constructor<ExtendsClauseableNodeExtensionType>>(Base: T): Constructor<ExtendsClauseableNode> & T;

Expand Down Expand Up @@ -8677,7 +8689,7 @@ export declare class UnionTypeNode extends TypeNode<ts.UnionTypeNode> {
getTypeNodes(): TypeNode[];
}

declare const VariableDeclarationBase: Constructor<ExclamationTokenableNode> & Constructor<TypedNode> & Constructor<InitializerExpressionableNode> & Constructor<BindingNamedNode> & typeof Node;
declare const VariableDeclarationBase: Constructor<ExportGetableNode> & Constructor<ExclamationTokenableNode> & Constructor<TypedNode> & Constructor<InitializerExpressionableNode> & Constructor<BindingNamedNode> & typeof Node;

export declare class VariableDeclaration extends VariableDeclarationBase<ts.VariableDeclaration> {
/**
Expand Down
197 changes: 0 additions & 197 deletions src/compiler/ast/base/ExportableNode.ts

This file was deleted.

0 comments on commit 0991e96

Please sign in to comment.