mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge pull request #30849 from cameron-martin/scope-push-options
[@babel/traverse]: Added types to argument of Scope#push.
This commit is contained in:
@@ -89,7 +89,8 @@ const v1: Visitor = {
|
||||
|
||||
const id = path.scope.generateUidIdentifierBasedOnNode(path.node.id!);
|
||||
path.remove();
|
||||
path.scope.parent.push({ id, init: path.node });
|
||||
path.scope.parent.push({ id });
|
||||
path.scope.parent.push({ id, init: t.stringLiteral('foo'), kind: "const" });
|
||||
|
||||
path.scope.rename("n", "x");
|
||||
path.scope.rename("n");
|
||||
@@ -104,7 +105,7 @@ const BindingKindTest: Visitor = {
|
||||
kind === 'const';
|
||||
kind === 'let';
|
||||
kind === 'var';
|
||||
// The following should fail when uncommented
|
||||
// kind === 'anythingElse';
|
||||
// $ExpectError
|
||||
kind === 'anythingElse';
|
||||
},
|
||||
};
|
||||
|
||||
Vendored
+6
-1
@@ -90,7 +90,12 @@ export class Scope {
|
||||
|
||||
removeData(key: string): void;
|
||||
|
||||
push(opts: any): void;
|
||||
push(opts: {
|
||||
id: t.LVal,
|
||||
init?: t.Expression,
|
||||
unique?: boolean,
|
||||
kind?: "var" | "let" | "const",
|
||||
}): void;
|
||||
|
||||
getProgramParent(): Scope;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user