1
votes

RequireJS path mappings are configured by calling requirejs.config. The requirejs object is a global variable; however, all type definitions available for RequireJS expose it as a module to be imported, rather than as a global variable.

How should I use RequireJS with TypeScript?

1

1 Answers

1
votes

How should I use RequireJS with TypeScript

If you just download this file : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/requirejs/require.d.ts and include it in your project it will work fine i.e. will make the require function globally available as seen here

Tip

I don't recommend requirejs and recommend going all in with commonjs and using something like webpack. Intro : https://basarat.gitbooks.io/typescript/content/docs/quick/browser.html