I know that nodejs + requirejs is not something that exists at runtime (you are either in nodejs or requirejs/browser). But these definition files should not conflict with one another. Reason, say you have a file a.ts that you want to use both in nodejs and in browser / requirejs. If you have a reference file node_ref.ts and another browser_ref.ts you still need to reference both from a.ts and that will bring in node + requirejs into a.ts which will cause issues.
Issue report : http://stackoverflow.com/questions/21380588/conflict-between-requirejs-and-nodejs-definitions-in-typescript
Error message : Subsequent variable declarations must have the same type.
Solution: require and define signatures should be separated into an interface
suggestion: ping to main maintainers of requirejs.d.ts.
It can't be done. Reason:
https://github.com/borisyankov/DefinitelyTyped/blob/master/node/node.d.ts#L30 will conflict with https://github.com/borisyankov/DefinitelyTyped/blob/master/requirejs/require.d.ts#L236
as demonstrated by following code :
// RequireJS.d.ts
interface Require{
(module:string):any;
}
// NodeJS.d.ts
interface Require{
(module:string):any;
}
Error message: duplicate overload signature.
I don't want there to be another file that people need to download / import which will contain just this single signature. But if too many people ask for this it can be done.
I'm getting this error too @basarat . What would it involve to fix this issue (with another file with a single signature)?
@flyon you need to manually edit and delete one of the signatures of (module:string):any
I'm facing a similar issue as I'm creating an Electron project. But node is my only folder in node_modules/@types.
My editor (VSCode) comes up with that message when I open the index.d.ts:
'Subsequent variable declarations must have the same type. Variable 'process' must be of type 'any', but here has type 'Process'.'
'Subsequent variable declarations must have the same type. Variable '__dirname' must be of type 'any', but here has type 'string'.'
any solution here yet? I am facing the same issue.
Most helpful comment
any solution here yet? I am facing the same issue.