-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
This seems to me first a kind a module resolution clash. @types/http-proxy uses url
// index.ts.d
import * as url from "url";
Unfortunately or not, url ist also installed for The core url packaged standalone for use with Browserify. It has no @types installed. TS module resolution follows from now that url module JS path.
Second, applying the jsconfig.json settings on those, result in a bunch of errors for node_modules artifacts, which are NOT related to any module usage surface in any user files that are included under src/*.
TypeScript Version: 3.0.0-dev.20180601
Search Terms:
include, exclude, order, node_modules, js ts check
Code
// jsconfig.json
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"checkJs": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": "node",
"strict": true,
"target": "es6",
"baseUrl": ".",
"lib": ["es2016", "dom"],
"sourceMap": true,
"jsx": "preserve"
},
"exclude": ["dist", "node_modules", "target"],
"include": ["src/**/*", "types/**/*"],
//"include": ["types/**/*", "src/**/*"],
"typeAcquisition": {
"enable": true
}
}
// package.json
"devDependencies": {
"@types/http-proxy": "^1.16.2",
"@types/storybook__addon-links": "^3.3.0",
"http-proxy": "^1.17.0",
"typescript": "^3.0.0-dev.20180601",
"url": "^0.11.0"
},
Expected behavior:
no error
Actual behavior:
Error Output
// target/tsc.trace1.log
...
node_modules/punycode/punycode.js(8,11): error TS2339: Property 'nodeType' does not exist on type 'NodeModule'.
node_modules/punycode/punycode.js(11,14): error TS2339: Property 'global' does not exist on type 'false | Global'.
Property 'global' does not exist on type 'false'.
node_modules/punycode/punycode.js(12,14): error TS2339: Property 'window' does not exist on type 'false | Global'.
Property 'window' does not exist on type 'false'.
node_modules/punycode/punycode.js(13,14): error TS2339: Property 'self' does not exist on type 'false | Global'.
Property 'self' does not exist on type 'false'.
node_modules/punycode/punycode.js(74,23): error TS8024: JSDoc '@param' tag has name 'callback', but there is no parameter with that name.
node_modules/punycode/punycode.js(78,22): error TS7006: Parameter 'fn' implicitly has an 'any' type.
...
node_modules/url/url.js(729,41): error TS2531: Object is possibly 'null'.
node_modules/url/util.js(4,22): error TS7006: Parameter 'arg' implicitly has an 'any' type.
node_modules/url/util.js(7,22): error TS7006: Parameter 'arg' implicitly has an 'any' type.
node_modules/url/util.js(10,20): error TS7006: Parameter 'arg' implicitly has an 'any' type.
node_modules/url/util.js(13,31): error TS7006: Parameter 'arg' implicitly has an 'any' type.
Resolution Output
// target/tsc.trace1.log
...
======== Resolving module 'url' from '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/@types/http-proxy/index.d.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
'baseUrl' option is set to '/home/joma/entwicklung/nodews/ts-js-include-order-issue', using this value to resolve non-relative module name 'url'.
Resolving module name 'url' relative to base url '/home/joma/entwicklung/nodews/ts-js-include-order-issue' - '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url'.
Loading module as file / folder, candidate module location '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url', target file type 'TypeScript'.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url.ts' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url.tsx' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url.d.ts' does not exist.
Directory '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url' does not exist, skipping all lookups in it.
Loading module 'url' from 'node_modules' folder, target file type 'TypeScript'.
Directory '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/@types/http-proxy/node_modules' does not exist, skipping all lookups in it.
Directory '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/@types/node_modules' does not exist, skipping all lookups in it.
'package.json' does not have a 'typings' field.
'package.json' does not have a 'types' field.
'package.json' has 'main' field './url.js' that references '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js'.
Found 'package.json' at '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/package.json'. Package ID is 'url/url.d.ts@0.11.0'.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url.ts' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url.tsx' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url.d.ts' does not exist.
'package.json' does not have a 'typings' field.
'package.json' does not have a 'types' field.
'package.json' has 'main' field './url.js' that references '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js'.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js' exist - use it as a name resolution result.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js' has an unsupported extension, so skipping it.
Loading module as file / folder, candidate module location '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js', target file type 'TypeScript'.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js.ts' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js.tsx' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js.d.ts' does not exist.
File name '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js' has a '.js' extension - stripping it.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.ts' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.tsx' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.d.ts' does not exist.
Directory '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js' does not exist, skipping all lookups in it.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/index.ts' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/index.tsx' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/index.d.ts' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/@types/url.d.ts' does not exist.
Directory '/home/joma/entwicklung/nodews/node_modules' does not exist, skipping all lookups in it.
Directory '/home/joma/entwicklung/node_modules' does not exist, skipping all lookups in it.
Directory '/home/joma/node_modules' does not exist, skipping all lookups in it.
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
'baseUrl' option is set to '/home/joma/entwicklung/nodews/ts-js-include-order-issue', using this value to resolve non-relative module name 'url'.
Resolving module name 'url' relative to base url '/home/joma/entwicklung/nodews/ts-js-include-order-issue' - '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url'.
Loading module as file / folder, candidate module location '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url', target file type 'JavaScript'.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url.js' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url.jsx' does not exist.
Directory '/home/joma/entwicklung/nodews/ts-js-include-order-issue/url' does not exist, skipping all lookups in it.
Loading module 'url' from 'node_modules' folder, target file type 'JavaScript'.
Directory '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/@types/http-proxy/node_modules' does not exist, skipping all lookups in it.
Directory '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/@types/node_modules' does not exist, skipping all lookups in it.
'package.json' does not have a 'typings' field.
'package.json' does not have a 'types' field.
'package.json' has 'main' field './url.js' that references '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js'.
Found 'package.json' at '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/package.json'. Package ID is 'url/url.d.ts@0.11.0'.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url.js' does not exist.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url.jsx' does not exist.
'package.json' has 'main' field './url.js' that references '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js'.
File '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js' exist - use it as a name resolution result.
Resolving real path for '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js', result '/home/joma/entwicklung/nodews/ts-js-include-order-issue/node_modules/url/url.js'.
...
Playground Link:
https://github.com/joma74/ts-js-include-order-issue
Run
yarn tsc:validate
or
yarn tsc:listFiles
Related Issues: