From db9916dd75eebcf3c42b34cd8e25d4bb7e1441f1 Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 23 Feb 2021 22:19:07 +0100 Subject: [PATCH] test(scope-manager): add missing test cases for typeof import --- .../type-declaration/type-query-qualified.ts | 3 + .../type-query-qualified.ts.shot | 96 +++++++++++++++++++ .../typeof-import-type-with-qualifier.ts | 1 + .../typeof-import-type-with-qualifier.ts.shot | 38 ++++++++ 4 files changed, 138 insertions(+) create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts.shot create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts.shot 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, + ], + }, + ], +} +`; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy