DefinitelyTyped / DefinitelyTyped/DefinitelyTyped
@types/requirejs Variable 'require' must be of type 'NodeRequire'
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 51.4k
- Forks
- 30.4k
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 108
Description
- I tried using the
@types/requirejspackage and had problems.
Error from console:
node_modules/@types/requirejs/index.d.ts
(416,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'require' must be of type 'NodeRequire', but here has type 'Require'.
typescript error -
in @types/requirejs/index.d.ts
ln416 declare var require: Require;
And in @types/node/index.d.ts
ln73 declare var require: NodeRequire;
Thanks
Michelle
- I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
"typescript": "2.2.1", - I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
- Mention the authors (see
Definitions by:inindex.d.ts) so they can respond.- Authors: @Josh Baldwin
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the require declarations in node_modules/@types/requirejs/index.d.ts at line 416 and node_modules/@types/node/index.d.ts at line 73, using the reported TypeScript 2.2.1 error as the reproduction. The work is done when consuming both definitions no longer produces TS2403 for require; no test file is mentioned in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100