Skip to content

Commit

Permalink
Share example code to repro microsoft/TypeScript#8113
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
theoy committed Apr 16, 2016
0 parents commit 7b778b8
Show file tree
Hide file tree
Showing 13 changed files with 135 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**/node_modules/
/**/*.d.ts
/**/*.js
/**/npm-debug.log

13 changes: 13 additions & 0 deletions A/.npmignore
Original file line number Diff line number Diff line change
@@ -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

7 changes: 7 additions & 0 deletions A/A.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ext from 'ext';

// module augmentation block for 'ext'
declare module 'ext' {
}

export default {};
16 changes: 16 additions & 0 deletions A/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
12 changes: 12 additions & 0 deletions A/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"target": "es5",
"declaration": true
},
"exclude": [
"node_modules"
]
}
12 changes: 12 additions & 0 deletions B/.npmignore
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions B/B.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Uncomment the below line to demo the workaround
// import ext from 'ext';
import modA from 'a';
17 changes: 17 additions & 0 deletions B/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
12 changes: 12 additions & 0 deletions B/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"target": "es5",
"declaration": true
},
"exclude": [
"node_modules"
]
}
12 changes: 12 additions & 0 deletions ext/.npmignore
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions ext/ext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
13 changes: 13 additions & 0 deletions ext/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "ext",
"version": "0.1.0",
"private": true,
"main": "ext",
"typings": "ext",
"devDependencies": {
"typescript": "^1.8.10"
},
"scripts": {
"prepublish": "tsc"
}
}
12 changes: 12 additions & 0 deletions ext/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"target": "es5",
"declaration": true
},
"exclude": [
"node_modules"
]
}

0 comments on commit 7b778b8

Please sign in to comment.