microsoft / microsoft/TypeScript
Should resolveJsonModule resolve json files without a .json file extension?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 2.9.0-dev.20180521
Search Terms:
- json
- resolveJsonModule
Code
In a project using resolveJsonModule.
For a file:
import foo = require('./foo')
import foo2 = require('./foo.json')
console.log(foo, foo2);
Expected behavior:
If we follow node, both imports are resolved
Actual behavior:
Only the foo2 import is resolved. The import without the .json file extension is not resolved
Contributor guide
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 reproducing the two imports with TypeScript 2.9.0-dev.20180521 and the resolveJsonModule option, then trace module resolution for extensionless and explicit .json paths. Done means an extensionless import resolves the same JSON file as the explicit import, with the existing behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100