@@ -230,7 +230,8 @@ pub use match_ts_type;
230230///
231231/// <https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#handbook-content>
232232#[ visited_node]
233- #[ derive( Debug , Hash ) ]
233+ #[ scope]
234+ #[ derive( Debug ) ]
234235#[ cfg_attr( feature = "serialize" , derive( Serialize , Tsify ) ) ]
235236#[ cfg_attr( feature = "serialize" , serde( tag = "type" , rename_all = "camelCase" ) ) ]
236237pub struct TSConditionalType < ' a > {
@@ -240,6 +241,7 @@ pub struct TSConditionalType<'a> {
240241 pub extends_type : TSType < ' a > ,
241242 pub true_type : TSType < ' a > ,
242243 pub false_type : TSType < ' a > ,
244+ pub scope_id : Cell < Option < ScopeId > > ,
243245}
244246
245247/// string | string[] | (() => string) | { s: string }
@@ -579,8 +581,7 @@ pub struct TSTypeParameterInstantiation<'a> {
579581}
580582
581583#[ visited_node]
582- #[ scope]
583- #[ derive( Debug ) ]
584+ #[ derive( Debug , Hash ) ]
584585#[ cfg_attr( feature = "serialize" , derive( Serialize , Tsify ) ) ]
585586#[ cfg_attr( feature = "serialize" , serde( tag = "type" , rename_all = "camelCase" ) ) ]
586587pub struct TSTypeParameter < ' a > {
@@ -592,7 +593,6 @@ pub struct TSTypeParameter<'a> {
592593 pub r#in : bool ,
593594 pub out : bool ,
594595 pub r#const : bool ,
595- pub scope_id : Cell < Option < ScopeId > > ,
596596}
597597
598598#[ visited_node]
@@ -606,16 +606,19 @@ pub struct TSTypeParameterDeclaration<'a> {
606606}
607607
608608#[ visited_node]
609- #[ derive( Debug , Hash ) ]
609+ #[ scope]
610+ #[ derive( Debug ) ]
610611#[ cfg_attr( feature = "serialize" , derive( Serialize , Tsify ) ) ]
611612#[ cfg_attr( feature = "serialize" , serde( tag = "type" , rename_all = "camelCase" ) ) ]
612613pub struct TSTypeAliasDeclaration < ' a > {
613614 #[ cfg_attr( feature = "serialize" , serde( flatten) ) ]
614615 pub span : Span ,
615616 pub id : BindingIdentifier < ' a > ,
617+ #[ scope( enter_before) ]
616618 pub type_parameters : Option < Box < ' a , TSTypeParameterDeclaration < ' a > > > ,
617619 pub type_annotation : TSType < ' a > ,
618620 pub declare : bool ,
621+ pub scope_id : Cell < Option < ScopeId > > ,
619622}
620623
621624#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
@@ -642,17 +645,20 @@ pub struct TSClassImplements<'a> {
642645///
643646/// interface `BindingIdentifier` `TypeParameters_opt` `InterfaceExtendsClause_opt` `ObjectType`
644647#[ visited_node]
645- #[ derive( Debug , Hash ) ]
648+ #[ scope]
649+ #[ derive( Debug ) ]
646650#[ cfg_attr( feature = "serialize" , derive( Serialize , Tsify ) ) ]
647651#[ cfg_attr( feature = "serialize" , serde( tag = "type" , rename_all = "camelCase" ) ) ]
648652pub struct TSInterfaceDeclaration < ' a > {
649653 #[ cfg_attr( feature = "serialize" , serde( flatten) ) ]
650654 pub span : Span ,
651655 pub id : BindingIdentifier < ' a > ,
656+ #[ scope( enter_before) ]
652657 pub extends : Option < Vec < ' a , TSInterfaceHeritage < ' a > > > ,
653658 pub type_parameters : Option < Box < ' a , TSTypeParameterDeclaration < ' a > > > ,
654659 pub body : Box < ' a , TSInterfaceBody < ' a > > ,
655660 pub declare : bool ,
661+ pub scope_id : Cell < Option < ScopeId > > ,
656662}
657663
658664#[ visited_node]
@@ -726,7 +732,8 @@ pub enum TSMethodSignatureKind {
726732}
727733
728734#[ visited_node]
729- #[ derive( Debug , Hash ) ]
735+ #[ scope]
736+ #[ derive( Debug ) ]
730737#[ cfg_attr( feature = "serialize" , derive( Serialize , Tsify ) ) ]
731738#[ cfg_attr( feature = "serialize" , serde( tag = "type" , rename_all = "camelCase" ) ) ]
732739pub struct TSMethodSignature < ' a > {
@@ -740,10 +747,12 @@ pub struct TSMethodSignature<'a> {
740747 pub params : Box < ' a , FormalParameters < ' a > > ,
741748 pub return_type : Option < Box < ' a , TSTypeAnnotation < ' a > > > ,
742749 pub type_parameters : Option < Box < ' a , TSTypeParameterDeclaration < ' a > > > ,
750+ pub scope_id : Cell < Option < ScopeId > > ,
743751}
744752
745753#[ visited_node]
746- #[ derive( Debug , Hash ) ]
754+ #[ scope]
755+ #[ derive( Debug ) ]
747756#[ cfg_attr( feature = "serialize" , derive( Serialize , Tsify ) ) ]
748757#[ cfg_attr( feature = "serialize" , serde( tag = "type" , rename_all = "camelCase" ) ) ]
749758pub struct TSConstructSignatureDeclaration < ' a > {
@@ -752,6 +761,7 @@ pub struct TSConstructSignatureDeclaration<'a> {
752761 pub params : Box < ' a , FormalParameters < ' a > > ,
753762 pub return_type : Option < Box < ' a , TSTypeAnnotation < ' a > > > ,
754763 pub type_parameters : Option < Box < ' a , TSTypeParameterDeclaration < ' a > > > ,
764+ pub scope_id : Cell < Option < ScopeId > > ,
755765}
756766
757767#[ visited_node]
@@ -994,7 +1004,8 @@ pub struct TSConstructorType<'a> {
9941004}
9951005
9961006#[ visited_node]
997- #[ derive( Debug , Hash ) ]
1007+ #[ scope]
1008+ #[ derive( Debug ) ]
9981009#[ cfg_attr( feature = "serialize" , derive( Serialize , Tsify ) ) ]
9991010#[ cfg_attr( feature = "serialize" , serde( tag = "type" , rename_all = "camelCase" ) ) ]
10001011pub struct TSMappedType < ' a > {
@@ -1005,6 +1016,7 @@ pub struct TSMappedType<'a> {
10051016 pub type_annotation : Option < TSType < ' a > > ,
10061017 pub optional : TSMappedTypeModifierOperator ,
10071018 pub readonly : TSMappedTypeModifierOperator ,
1019+ pub scope_id : Cell < Option < ScopeId > > ,
10081020}
10091021
10101022#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
0 commit comments