Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4e83b52
Update: add proper scope analysis (fixes #535)
mysticatea Nov 4, 2018
1cfbb6e
add computed-properties-in-type fixture
mysticatea Nov 6, 2018
1ec6b3a
add computed-properties-in-interface fixture
mysticatea Nov 6, 2018
80b13cf
add function-overload fixture
mysticatea Nov 6, 2018
3d7cfb2
add method-overload fixture
mysticatea Nov 6, 2018
f61e133
add class-properties fixture
mysticatea Nov 6, 2018
bdd99e9
add decorators fixture
mysticatea Nov 6, 2018
f908e81
update visitor-keys
mysticatea Nov 6, 2018
00ce3dc
add declare-global fixture
mysticatea Nov 7, 2018
bbf0b69
fix typo
mysticatea Nov 7, 2018
257e953
add test for typeof in array destructuring
mysticatea Nov 7, 2018
85b9067
add namespace fixture
mysticatea Nov 7, 2018
7a8e250
add declare-module fixture
mysticatea Nov 7, 2018
8a9eb40
fix crash
mysticatea Nov 7, 2018
5e3b3f6
add declare-function.ts fixture
mysticatea Nov 7, 2018
efeda57
add abstract-class fixture
mysticatea Nov 7, 2018
f5de9b0
add typeof-in-call-signature fixture
mysticatea Nov 8, 2018
7ce5d61
add test for #416
mysticatea Nov 8, 2018
ca4b08f
add test for #435
mysticatea Nov 8, 2018
72f7120
add test for #437
mysticatea Nov 8, 2018
b8b86fd
add test for #443
mysticatea Nov 8, 2018
49ce2da
add test for #459
mysticatea Nov 8, 2018
13f50c3
add test for #466
mysticatea Nov 8, 2018
180cbfe
add test for #471
mysticatea Nov 8, 2018
6e70971
add test for #487
mysticatea Nov 8, 2018
81f4f30
add test for #535
mysticatea Nov 8, 2018
95a8380
add test for #536
mysticatea Nov 8, 2018
14e2499
Merge remote-tracking branch 'origin/master' into fix-scope-analysis
mysticatea Nov 8, 2018
044563b
add test for #476
mysticatea Nov 8, 2018
2a5669d
fix test to use `expect()`
mysticatea Nov 9, 2018
b79045e
Merge remote-tracking branch 'origin/master' into fix-scope-analysis
mysticatea Nov 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add typeof-in-call-signature fixture
  • Loading branch information
mysticatea committed Nov 8, 2018
commit f5de9b0c0bf034c91c4532e1ca56efeec41b1327
5 changes: 5 additions & 0 deletions tests/fixtures/scope-analysis/typeof-in-call-signature.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const obj = { value: 1 }
interface A {
<T extends typeof obj>(a: typeof obj, b: T): typeof obj
new <T extends typeof obj>(a: typeof obj, b: T): typeof obj
}
238 changes: 238 additions & 0 deletions tests/lib/__snapshots__/scope-analysis.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4464,6 +4464,244 @@ Object {
}
`;

exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = `
Object {
"$id": 8,
"block": Object {
"range": Array [
0,
165,
],
"type": "Program",
},
"childScopes": Array [],
"functionExpressionScope": false,
"isStrict": false,
"references": Array [
Object {
"$id": 1,
"from": Object {
"$ref": 8,
},
"identifier": Object {
"name": "obj",
"range": Array [
6,
9,
],
"type": "Identifier",
},
"kind": "w",
"resolved": Object {
"$ref": 0,
},
"writeExpr": Object {
"range": Array [
12,
24,
],
"type": "ObjectExpression",
},
},
Object {
"$id": 2,
"from": Object {
"$ref": 8,
},
"identifier": Object {
"name": "obj",
"range": Array [
61,
64,
],
"type": "Identifier",
},
"kind": "r",
"resolved": Object {
"$ref": 0,
},
"writeExpr": undefined,
},
Object {
"$id": 3,
"from": Object {
"$ref": 8,
},
"identifier": Object {
"name": "obj",
"range": Array [
76,
79,
],
"type": "Identifier",
},
"kind": "r",
"resolved": Object {
"$ref": 0,
},
"writeExpr": undefined,
},
Object {
"$id": 4,
"from": Object {
"$ref": 8,
},
"identifier": Object {
"name": "obj",
"range": Array [
95,
98,
],
"type": "Identifier",
},
"kind": "r",
"resolved": Object {
"$ref": 0,
},
"writeExpr": undefined,
},
Object {
"$id": 5,
"from": Object {
"$ref": 8,
},
"identifier": Object {
"name": "obj",
"range": Array [
125,
128,
],
"type": "Identifier",
},
"kind": "r",
"resolved": Object {
"$ref": 0,
},
"writeExpr": undefined,
},
Object {
"$id": 6,
"from": Object {
"$ref": 8,
},
"identifier": Object {
"name": "obj",
"range": Array [
140,
143,
],
"type": "Identifier",
},
"kind": "r",
"resolved": Object {
"$ref": 0,
},
"writeExpr": undefined,
},
Object {
"$id": 7,
"from": Object {
"$ref": 8,
},
"identifier": Object {
"name": "obj",
"range": Array [
159,
162,
],
"type": "Identifier",
},
"kind": "r",
"resolved": Object {
"$ref": 0,
},
"writeExpr": undefined,
},
],
"throughReferences": Array [],
"type": "global",
"upperScope": null,
"variableMap": Object {
"obj": Object {
"$ref": 0,
},
},
"variableScope": Object {
"$ref": 8,
},
"variables": Array [
Object {
"$id": 0,
"defs": Array [
Object {
"name": Object {
"name": "obj",
"range": Array [
6,
9,
],
"type": "Identifier",
},
"node": Object {
"range": Array [
6,
24,
],
"type": "VariableDeclarator",
},
"parent": Object {
"range": Array [
0,
24,
],
"type": "VariableDeclaration",
},
"type": "Variable",
},
],
"eslintUsed": undefined,
"identifiers": Array [
Object {
"name": "obj",
"range": Array [
6,
9,
],
"type": "Identifier",
},
],
"name": "obj",
"references": Array [
Object {
"$ref": 1,
},
Object {
"$ref": 2,
},
Object {
"$ref": 3,
},
Object {
"$ref": 4,
},
Object {
"$ref": 5,
},
Object {
"$ref": 6,
},
Object {
"$ref": 7,
},
],
"scope": Object {
"$ref": 8,
},
},
],
}
`;

exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = `
Object {
"$id": 5,
Expand Down
3 changes: 2 additions & 1 deletion visitor-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ module.exports = Evk.unionWith({
TSArrayType: ["elementType"],
TSAsyncKeyword: [],
TSBooleanKeyword: [],
TSCallSignature: ["typeParameters", "parameters", "typeAnnotation"],
TSConstructSignature: ["typeParameters", "params", "typeAnnotation"],
TSConstructorType: ["typeAnnotation", "parameters"],
TSConstructSignature: ["typeAnnotation", "typeParameters"],
TSDeclareKeyword: [],
TSEmptyBodyDeclareFunction: ["id", "typeParameters", "params", "returnType"],
TSEmptyBodyFunctionDeclaration: ["id", "typeParameters", "params", "returnType"],
Expand Down