From 7b778b84805010d032124db06ca540f9e719e6f9 Mon Sep 17 00:00:00 2001 From: Theo Yaung Date: Sat, 16 Apr 2016 21:42:01 +0100 Subject: [PATCH] Share example code to repro Microsoft/TypeScript#8113 To repro: 1. git clean -xdf 2. cd ext && npm install 3. cd ../A && npm install 4. cd ../B && npm install Note, TSC is set as npm prepublish, which runs it automatically after npm install. --- .gitignore | 5 +++++ A/.npmignore | 13 +++++++++++++ A/A.ts | 7 +++++++ A/package.json | 16 ++++++++++++++++ A/tsconfig.json | 12 ++++++++++++ B/.npmignore | 12 ++++++++++++ B/B.ts | 3 +++ B/package.json | 17 +++++++++++++++++ B/tsconfig.json | 12 ++++++++++++ ext/.npmignore | 12 ++++++++++++ ext/ext.ts | 1 + ext/package.json | 13 +++++++++++++ ext/tsconfig.json | 12 ++++++++++++ 13 files changed, 135 insertions(+) create mode 100644 .gitignore create mode 100644 A/.npmignore create mode 100644 A/A.ts create mode 100644 A/package.json create mode 100644 A/tsconfig.json create mode 100644 B/.npmignore create mode 100644 B/B.ts create mode 100644 B/package.json create mode 100644 B/tsconfig.json create mode 100644 ext/.npmignore create mode 100644 ext/ext.ts create mode 100644 ext/package.json create mode 100644 ext/tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e7ba852 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/**/node_modules/ +/**/*.d.ts +/**/*.js +/**/npm-debug.log + diff --git a/A/.npmignore b/A/.npmignore new file mode 100644 index 0000000..b7dc58e --- /dev/null +++ b/A/.npmignore @@ -0,0 +1,13 @@ +# ship a minimal package, of runnable JS files +# and d.ts type definitions + +# exclude the original .ts files +/**/*.ts + +# re-include the d.ts files +!/**/*.d.ts + +# exclude design-time metadata +/.npmignore +/tsconfig.json + diff --git a/A/A.ts b/A/A.ts new file mode 100644 index 0000000..7aea39b --- /dev/null +++ b/A/A.ts @@ -0,0 +1,7 @@ +import ext from 'ext'; + +// module augmentation block for 'ext' +declare module 'ext' { +} + +export default {}; diff --git a/A/package.json b/A/package.json new file mode 100644 index 0000000..ab77c09 --- /dev/null +++ b/A/package.json @@ -0,0 +1,16 @@ +{ + "name": "a", + "version": "0.1.0", + "private": true, + "main": "A", + "typings": "A", + "devDependencies": { + "typescript": "^1.8.10" + }, + "scripts": { + "prepublish": "tsc" + }, + "dependencies": { + "ext": "file:../ext" + } +} diff --git a/A/tsconfig.json b/A/tsconfig.json new file mode 100644 index 0000000..694c35d --- /dev/null +++ b/A/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "noImplicitAny": true, + "target": "es5", + "declaration": true + }, + "exclude": [ + "node_modules" + ] +} diff --git a/B/.npmignore b/B/.npmignore new file mode 100644 index 0000000..54a0299 --- /dev/null +++ b/B/.npmignore @@ -0,0 +1,12 @@ +# ship a minimal package, of runnable JS files +# and d.ts type definitions + +# exclude the original .ts files +/**/*.ts + +# re-include the d.ts files +!/**/*.d.ts + +# exclude design-time metadata +/.npmignore +/tsconfig.json diff --git a/B/B.ts b/B/B.ts new file mode 100644 index 0000000..441c5ff --- /dev/null +++ b/B/B.ts @@ -0,0 +1,3 @@ +// Uncomment the below line to demo the workaround +// import ext from 'ext'; +import modA from 'a'; diff --git a/B/package.json b/B/package.json new file mode 100644 index 0000000..8305b76 --- /dev/null +++ b/B/package.json @@ -0,0 +1,17 @@ +{ + "name": "b", + "version": "0.1.0", + "private": true, + "main": "B", + "typings": "B", + "devDependencies": { + "typescript": "^1.8.10" + }, + "scripts": { + "prepublish": "tsc" + }, + "dependencies": { + "a": "file:../A", + "ext": "file:../ext" + } +} diff --git a/B/tsconfig.json b/B/tsconfig.json new file mode 100644 index 0000000..694c35d --- /dev/null +++ b/B/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "noImplicitAny": true, + "target": "es5", + "declaration": true + }, + "exclude": [ + "node_modules" + ] +} diff --git a/ext/.npmignore b/ext/.npmignore new file mode 100644 index 0000000..54a0299 --- /dev/null +++ b/ext/.npmignore @@ -0,0 +1,12 @@ +# ship a minimal package, of runnable JS files +# and d.ts type definitions + +# exclude the original .ts files +/**/*.ts + +# re-include the d.ts files +!/**/*.d.ts + +# exclude design-time metadata +/.npmignore +/tsconfig.json diff --git a/ext/ext.ts b/ext/ext.ts new file mode 100644 index 0000000..ff8b4c5 --- /dev/null +++ b/ext/ext.ts @@ -0,0 +1 @@ +export default {}; diff --git a/ext/package.json b/ext/package.json new file mode 100644 index 0000000..cd1fb9c --- /dev/null +++ b/ext/package.json @@ -0,0 +1,13 @@ +{ + "name": "ext", + "version": "0.1.0", + "private": true, + "main": "ext", + "typings": "ext", + "devDependencies": { + "typescript": "^1.8.10" + }, + "scripts": { + "prepublish": "tsc" + } +} diff --git a/ext/tsconfig.json b/ext/tsconfig.json new file mode 100644 index 0000000..694c35d --- /dev/null +++ b/ext/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "noImplicitAny": true, + "target": "es5", + "declaration": true + }, + "exclude": [ + "node_modules" + ] +}