diff --git a/types/babel-core/index.d.ts b/types/babel-core/index.d.ts index de09b2a91f..3a6da1b49d 100644 --- a/types/babel-core/index.d.ts +++ b/types/babel-core/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Troy Gerwien // Marvin Hagemeister // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as t from 'babel-types'; export { t as types }; diff --git a/types/babel-generator/index.d.ts b/types/babel-generator/index.d.ts index 2e34d158fc..8afeca4cd1 100644 --- a/types/babel-generator/index.d.ts +++ b/types/babel-generator/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Troy Gerwien // Johnny Estilles // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as t from 'babel-types'; diff --git a/types/babel-template/index.d.ts b/types/babel-template/index.d.ts index 467b0193e7..50b759c3f5 100644 --- a/types/babel-template/index.d.ts +++ b/types/babel-template/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Troy Gerwien // Marvin Hagemeister // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import { BabylonOptions } from 'babylon'; import * as t from 'babel-types'; diff --git a/types/babel-traverse/index.d.ts b/types/babel-traverse/index.d.ts index df420c17bd..5c18c3ff29 100644 --- a/types/babel-traverse/index.d.ts +++ b/types/babel-traverse/index.d.ts @@ -2,15 +2,17 @@ // Project: https://github.com/babel/babel/tree/master/packages/babel-traverse // Definitions by: Troy Gerwien // Marvin Hagemeister +// Ryan Petrich // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as t from 'babel-types'; export type Node = t.Node; -export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void; +export default function traverse(parent: Node | Node[], opts: TraverseOptions, scope: Scope, state: S, parentPath?: NodePath): void; +export default function traverse(parent: Node | Node[], opts: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void; -export interface TraverseOptions extends Visitor { +export interface TraverseOptions extends Visitor { scope?: Scope; noScope?: boolean; } @@ -25,6 +27,7 @@ export class Scope { bindings: { [name: string]: Binding; }; /** Traverse node with current scope and path. */ + traverse(node: Node | Node[], opts: TraverseOptions, state: S): void; traverse(node: Node | Node[], opts?: TraverseOptions, state?: any): void; /** Generate a unique identifier and add it to the current scope. */ @@ -339,10 +342,10 @@ export class NodePath { listKey: string; inList: boolean; parentKey: string; - key: string; + key: string | number; node: T; scope: Scope; - type: string; + type: T extends undefined | null ? string | null : string; typeAnnotation: object; getScope(scope: Scope): Scope; @@ -353,7 +356,8 @@ export class NodePath { buildCodeFrameError(msg: string, Error?: new (msg: string) => TError): TError; - traverse(visitor: Visitor, state?: any): void; + traverse(visitor: Visitor, state: T): void; + traverse(visitor: Visitor): void; set(key: string, node: Node): void; @@ -372,10 +376,10 @@ export class NodePath { find(callback: (path: NodePath) => boolean): NodePath; /** Get the parent function of the current path. */ - getFunctionParent(): NodePath; + getFunctionParent(): NodePath; /** Walk up the tree until we hit a parent node path in a list. */ - getStatementParent(): NodePath; + getStatementParent(): NodePath; /** * Get the deepest common ancestor and then from it, get the earliest relationship path @@ -537,6 +541,9 @@ export class NodePath { /** Get the source code associated with this node. */ getSource(): string; + /** Check if the current path will maybe execute before another path */ + willIMaybeExecuteBefore(path: NodePath): boolean; + // ------------------------- context ------------------------- call(key: string): boolean; @@ -582,9 +589,15 @@ export class NodePath { getCompletionRecords(): NodePath[]; - getSibling(key: string): NodePath; + getSibling(key: string | number): NodePath; + getAllPrevSiblings(): NodePath[]; + getAllNextSiblings(): NodePath[]; - get(key: string, context?: boolean | TraversalContext): NodePath; + get(key: K, context?: boolean | TraversalContext): + T[K] extends Array ? Array> : + T[K] extends Node | null | undefined ? NodePath : + never; + get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[]; getBindingIdentifiers(duplicates?: boolean): Node[]; diff --git a/types/babel-types/index.d.ts b/types/babel-types/index.d.ts index 8c892a3ca0..47068c3481 100644 --- a/types/babel-types/index.d.ts +++ b/types/babel-types/index.d.ts @@ -5,7 +5,7 @@ // Marvin Hagemeister // Boris Cherny // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 export interface Comment { value: string; diff --git a/types/babel-webpack-plugin/index.d.ts b/types/babel-webpack-plugin/index.d.ts index 3f16d154ac..6f85bae2cc 100644 --- a/types/babel-webpack-plugin/index.d.ts +++ b/types/babel-webpack-plugin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/simlrh/babel-webpack-plugin // Definitions by: Jed Fox // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import { Plugin } from 'webpack'; import { TransformOptions } from 'babel-core'; diff --git a/types/babelify/index.d.ts b/types/babelify/index.d.ts index f394d2ba44..ca90ae9d4c 100644 --- a/types/babelify/index.d.ts +++ b/types/babelify/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: TeamworkGuy2 // Marvin Hagemeister // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/babylon-walk/index.d.ts b/types/babylon-walk/index.d.ts index 02c3f39d10..43c9c1bf3a 100644 --- a/types/babylon-walk/index.d.ts +++ b/types/babylon-walk/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/pugjs/babylon-walk // Definitions by: Marek Buchar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as babelTypes from 'babel-types'; diff --git a/types/babylon/index.d.ts b/types/babylon/index.d.ts index eb22f30c13..07eb74bb32 100644 --- a/types/babylon/index.d.ts +++ b/types/babylon/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Troy Gerwien // Marvin Hagemeister // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import { File, Expression } from 'babel-types'; diff --git a/types/istanbul-lib-instrument/index.d.ts b/types/istanbul-lib-instrument/index.d.ts index e1d4e813f9..1b749a893c 100644 --- a/types/istanbul-lib-instrument/index.d.ts +++ b/types/istanbul-lib-instrument/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/istanbuljs/istanbuljs // Definitions by: Jason Cheatham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 import { FileCoverage, FileCoverageData, Range } from 'istanbul-lib-coverage'; import { RawSourceMap } from 'source-map'; diff --git a/types/prettier/index.d.ts b/types/prettier/index.d.ts index 7d6621d69b..881ca6b182 100644 --- a/types/prettier/index.d.ts +++ b/types/prettier/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/prettier/prettier // Definitions by: Ika // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 export type AST = any; export type Doc = doc.builders.Doc;