microsoft / microsoft/TypeScript
WebGLShader has no properties
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.7.3
Search Terms: array element type checking, error type checking, stops checking function argument types
Code
https://github.com/vjancik/dont-find-me-yet/blob/tsc-issue/src/index.ts#L63-L64
- fails to infer a possible Error type
- and if I set it explicitly (see Playground), fails to enforce it in
https://github.com/vjancik/dont-find-me-yet/blob/tsc-issue/src/index.ts#L146
createProgramdoesn't enforceWebGLShader[]at all on the first argument, or seemingly any of the other arguments as well. I can add any variable in there and the array accepts it (also Playground)
Expected behavior:
Types of fn. arguments on createProgram get enforced correctly.
Optional: Return type on loadShader & createProgram gets inferred correctly as ... | Error
Actual behavior:
The issue doesn't resolve even if I specify all return types on all functions manually.
Playground Link:
Playground link
Related Issues:
No, there are multiple problems and I can't pinpoint the cause in a very specific setup.
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 examples in src/index.ts at lines 63-64 and 146, then reproduce the reported behavior using the linked TypeScript Playground. Compare the inferred Error return types and argument checking for loadShader and createProgram; done means the function arguments are enforced and the expected return types are inferred correctly.
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
- Needs clarification
- Newbie friendliness
- 28/100