f0fe1b88ca
* Make isDefinition aware of target symbol Initial code, haven't fixed any tests yet. * Update baselines This commit includes a regression for commonjs aliases: ```js // @filename: a.js function f() { } module.exports.f = f // @filename: b.js const { f } = require('./a') f/**/ ``` Now says that `f` in b.js has 1 reference -- the alias `module.exports.f = f`. This is not correct (or not exactly correct), but correctly fixing will involve re-creating the ad-hoc commonjs alias resolution code from the checker. I don't think it's worth it for an edge case like this. * update more unit tests * Fix symbol lookup for constructors * More baselines + two fixes 1. Fix `default` support. 2. Add a secondary declaration location for commonjs assignment declarations. * Update rest of baselines * Switch a few more tests over to baselines
425 lines
8.7 KiB
Plaintext
425 lines
8.7 KiB
Plaintext
// === /typings/global.d.ts ===
|
|
// import * as _THREE from '[|three|]';
|
|
// declare global {
|
|
// const [|THREE|]: typeof _THREE;
|
|
// }
|
|
|
|
// === /src/index.ts ===
|
|
// export const a = {};
|
|
// let v = new [|THREE|].Vector2();
|
|
|
|
// === /node_modules/@types/three/index.d.ts ===
|
|
// export * from "./three-core";
|
|
// export as namespace /*FIND ALL REFS*/[|THREE|];
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/node_modules/@types/three/index.d.ts",
|
|
"kind": "var",
|
|
"name": "module THREE\nvar THREE: typeof import(\"/node_modules/@types/three/index\")",
|
|
"textSpan": {
|
|
"start": 0,
|
|
"length": 56
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "module",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "THREE",
|
|
"kind": "localName"
|
|
},
|
|
{
|
|
"text": "\n",
|
|
"kind": "lineBreak"
|
|
},
|
|
{
|
|
"text": "var",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "THREE",
|
|
"kind": "localName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "typeof",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "import",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "\"/node_modules/@types/three/index\"",
|
|
"kind": "stringLiteral"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
}
|
|
]
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 50,
|
|
"length": 5
|
|
},
|
|
"fileName": "/node_modules/@types/three/index.d.ts",
|
|
"contextSpan": {
|
|
"start": 30,
|
|
"length": 26
|
|
},
|
|
"isWriteAccess": true,
|
|
"isDefinition": true
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 25,
|
|
"length": 5
|
|
},
|
|
"fileName": "/typings/global.d.ts",
|
|
"contextSpan": {
|
|
"start": 0,
|
|
"length": 32
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 60,
|
|
"length": 5
|
|
},
|
|
"fileName": "/typings/global.d.ts",
|
|
"contextSpan": {
|
|
"start": 54,
|
|
"length": 27
|
|
},
|
|
"isWriteAccess": true,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 33,
|
|
"length": 5
|
|
},
|
|
"fileName": "/src/index.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
// === /typings/global.d.ts ===
|
|
// import * as _THREE from '/*FIND ALL REFS*/[|three|]';
|
|
// declare global {
|
|
// const [|THREE|]: typeof _THREE;
|
|
// }
|
|
|
|
// === /src/index.ts ===
|
|
// export const a = {};
|
|
// let v = new [|THREE|].Vector2();
|
|
|
|
// === /node_modules/@types/three/index.d.ts ===
|
|
// export * from "./three-core";
|
|
// export as namespace [|THREE|];
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/node_modules/@types/three/index.d.ts",
|
|
"kind": "var",
|
|
"name": "module THREE\nvar THREE: typeof import(\"/node_modules/@types/three/index\")",
|
|
"textSpan": {
|
|
"start": 0,
|
|
"length": 56
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "module",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "THREE",
|
|
"kind": "localName"
|
|
},
|
|
{
|
|
"text": "\n",
|
|
"kind": "lineBreak"
|
|
},
|
|
{
|
|
"text": "var",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "THREE",
|
|
"kind": "localName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "typeof",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "import",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "\"/node_modules/@types/three/index\"",
|
|
"kind": "stringLiteral"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
}
|
|
]
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 50,
|
|
"length": 5
|
|
},
|
|
"fileName": "/node_modules/@types/three/index.d.ts",
|
|
"contextSpan": {
|
|
"start": 30,
|
|
"length": 26
|
|
},
|
|
"isWriteAccess": true,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 25,
|
|
"length": 5
|
|
},
|
|
"fileName": "/typings/global.d.ts",
|
|
"contextSpan": {
|
|
"start": 0,
|
|
"length": 32
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 60,
|
|
"length": 5
|
|
},
|
|
"fileName": "/typings/global.d.ts",
|
|
"contextSpan": {
|
|
"start": 54,
|
|
"length": 27
|
|
},
|
|
"isWriteAccess": true,
|
|
"isDefinition": true
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 33,
|
|
"length": 5
|
|
},
|
|
"fileName": "/src/index.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
// === /typings/global.d.ts ===
|
|
// import * as _THREE from '[|three|]';
|
|
// declare global {
|
|
// const /*FIND ALL REFS*/[|THREE|]: typeof _THREE;
|
|
// }
|
|
|
|
// === /src/index.ts ===
|
|
// export const a = {};
|
|
// let v = new [|THREE|].Vector2();
|
|
|
|
// === /node_modules/@types/three/index.d.ts ===
|
|
// export * from "./three-core";
|
|
// export as namespace [|THREE|];
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/node_modules/@types/three/index.d.ts",
|
|
"kind": "var",
|
|
"name": "module THREE\nvar THREE: typeof import(\"/node_modules/@types/three/index\")",
|
|
"textSpan": {
|
|
"start": 0,
|
|
"length": 56
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "module",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "THREE",
|
|
"kind": "localName"
|
|
},
|
|
{
|
|
"text": "\n",
|
|
"kind": "lineBreak"
|
|
},
|
|
{
|
|
"text": "var",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "THREE",
|
|
"kind": "localName"
|
|
},
|
|
{
|
|
"text": ":",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "typeof",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": " ",
|
|
"kind": "space"
|
|
},
|
|
{
|
|
"text": "import",
|
|
"kind": "keyword"
|
|
},
|
|
{
|
|
"text": "(",
|
|
"kind": "punctuation"
|
|
},
|
|
{
|
|
"text": "\"/node_modules/@types/three/index\"",
|
|
"kind": "stringLiteral"
|
|
},
|
|
{
|
|
"text": ")",
|
|
"kind": "punctuation"
|
|
}
|
|
]
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 50,
|
|
"length": 5
|
|
},
|
|
"fileName": "/node_modules/@types/three/index.d.ts",
|
|
"contextSpan": {
|
|
"start": 30,
|
|
"length": 26
|
|
},
|
|
"isWriteAccess": true,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 25,
|
|
"length": 5
|
|
},
|
|
"fileName": "/typings/global.d.ts",
|
|
"contextSpan": {
|
|
"start": 0,
|
|
"length": 32
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 60,
|
|
"length": 5
|
|
},
|
|
"fileName": "/typings/global.d.ts",
|
|
"contextSpan": {
|
|
"start": 54,
|
|
"length": 27
|
|
},
|
|
"isWriteAccess": true,
|
|
"isDefinition": true
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 33,
|
|
"length": 5
|
|
},
|
|
"fileName": "/src/index.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
}
|
|
] |