Expand type definitions for path.{get,set}Data to cover symbols (#13044)

This commit is contained in:
Anna Henningsen
2021-03-24 14:04:13 +01:00
committed by GitHub
parent 238ce0bac8
commit 1ef78ca55b
3 changed files with 12 additions and 4 deletions

View File

@@ -105,14 +105,14 @@ class NodePath<T extends t.Node = t.Node> {
return this.isScope() ? new Scope(this) : scope;
}
setData(key: string, val: any): any {
setData(key: string | symbol, val: any): any {
if (this.data == null) {
this.data = Object.create(null);
}
return (this.data[key] = val);
}
getData(key: string, def?: any): any {
getData(key: string | symbol, def?: any): any {
if (this.data == null) {
this.data = Object.create(null);
}