diff --git a/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts b/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts new file mode 100644 index 000000000000..4b1cc563d5f5 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts @@ -0,0 +1,3 @@ +const x = { y: { z: 1 } }; +type T = typeof x.y.z; +type Unresolved = x.y.z; diff --git a/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts.shot b/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts.shot new file mode 100644 index 000000000000..afb1ec52a0d2 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`type-declaration type-query-qualified 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + VariableDefinition$1 { + name: Identifier<"x">, + node: VariableDeclarator$1, + }, + ], + name: "x", + references: Array [ + Reference$1 { + identifier: Identifier<"x">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$2, + writeExpr: ObjectExpression$2, + }, + Reference$2 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$3 { + defs: Array [ + TypeDefinition$2 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$3, + }, + ], + name: "T", + references: Array [], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + TypeDefinition$3 { + name: Identifier<"Unresolved">, + node: TSTypeAliasDeclaration$4, + }, + ], + name: "Unresolved", + references: Array [], + isValueVariable: false, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$5, + isStrict: false, + references: Array [ + Reference$1, + Reference$2, + Reference$3 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: null, + }, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "x" => Variable$2, + "T" => Variable$3, + "Unresolved" => Variable$4, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + Variable$4, + ], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts b/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts new file mode 100644 index 000000000000..c61a204af86d --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts @@ -0,0 +1 @@ +type T = typeof import('').default; diff --git a/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts.shot b/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts.shot new file mode 100644 index 000000000000..95ad0a27df5b --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts.shot @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`type-declaration typeof-import-type-with-qualifier 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + TypeDefinition$1 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$1, + }, + ], + name: "T", + references: Array [], + isValueVariable: false, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$2, + isStrict: false, + references: Array [], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "T" => Variable$2, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + ], + }, + ], +} +`;