Incude .json file
How can I include .json file in typescript 1.5
For example : I have level.json file which I need to include in the typescript file
Depending on your module format / loader, you can load with that. It's not really something TypeScript itself concerns itself with.
However, one thing I've started doing for HTML templates is embedding them like so:
level.ts
export default `
(JSON / HTML goes here)
`;
import json from './level'; // json is string
i.e. defining it as an exported value using the backtick character. With JSON you could also do:
level.ts
export default JSON.parse(`
(JSON goes here)
`);
import level from './level'; // level is parsed object
What do you mean by "include"? if you want to import it as a module, then @jamiewinder's comments would be your best options. you can also look into using amd-dependency tags if you are using amd module loader.
@deryl27 is this still an issue?