microsoft / microsoft/TypeScript
Allow Typescript to detect when imported html relative paths are incorrect
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.8.1
Search Terms: html template import
Code
In global.d.ts:
declare module '*.html' {
const value: string;
export default value
}
Somewhere else in code:
import templateHtml from './SOME_PATH_THAT_DOESNT_EXIST.html'
Expected behavior:
I expect that Typescript will still attempt to parse the string in 'from' and tell me if it can't find any matching files, as it is a relative path.
Actual behavior:
No error or warning is emitted, so any typos in the path won't have a problem until running the app.
Playground Link:
Related Issues:
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 with the module-resolution and type-checking paths for the ambient '*.html' declaration shown in global.d.ts, using the import example as the reproduction. The work is done when a missing relative HTML path produces a diagnostic while a matching path continues to resolve through the declaration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100