microsoft / microsoft/pxt-microbit
Add support for Python's `cast` function type hint
Open
Nobody has claimed this yet.
python
- Dominant language
- TypeScript
- Stars
- 804
- Forks
- 721
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 2
Description
Python has a nifty cast function for type hinting expressions:
foo = cast(str, my_function())
this function does nothing, it just lets you assert the type of the second argument to be whatever is passed in as the first.
supporting this would make it much easier to paper over some of our type inference's deficiencies
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
No file, test, or entry point is identified in the issue. Start by locating the Python type-inference path and its existing type-hint handling; confirm completion by accepting cast(str, my_function()) and preserving the asserted type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100