3

I have my typescript sources in the path:

src/game/ts

tsconfig.json is in:

src/game/ts/tsconfig.json

and typings in:

src/game/ts/typings

I can run tsc fine with:

tsc --p src/game/ts

But I get undefined type errors (for types declared in src/game/ts/typings/**/*.d.ts files) using this command:

browserify --debug src/game/ts/main.ts -p [ tsify --p src/game/ts ] > public/game/js/bundle.js

Why isn't tsc picking up the definitions? My tsconfig.json contains:

"include": [
    "main.ts", "typings/**/*.d.ts"
],
pixelmike
  • 1,973
  • 1
  • 19
  • 31

2 Answers2

1

To include the typings, you only need to add the typings/index.d.ts file, as it references the other .d.ts files in the typings directory. So a glob is not required and you can simply use the files option:

"files": [
    "main.ts",
    "typings/index.d.ts"
]
cartant
  • 57,105
  • 17
  • 163
  • 197
0

"include" does not support globs. Please use the filesGlob option

More

this option was only recently added. Use nightly : https://basarat.gitbooks.io/typescript/content/docs/getting-started.html#typescript-version

basarat
  • 261,912
  • 58
  • 460
  • 511
  • I've tried both `filesGlob` and `include`. I've discovered I can make it work by passing each d.ts file in the command, although that makes for a very long command line. It doesn't seem to pick up the options from tsconfig.json either, so I have to add those as well. I'm guessing I cannot pass the project path through tsify. – pixelmike Jul 03 '16 at 14:16