microsoft / microsoft/pxt-microbit
Missing TypeScript definitions in Math namespace
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 804
- Forks
- 721
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 2
Description
Describe the bug
When using vscode to edit a project, functions like Math.map & Math.constrain are missing defintions.
To Reproduce
Steps to reproduce the behavior:
npm install -g pxt
pxt target microbit
pxt install
See https://github.com/CodeMan99/mb-lightning-bug
Expected behavior
TypeScript definitions in the Math namespace to be available. No error should be produced such as Property 'map' does not exit on type 'Math'. ts(2339).
Screenshots
micro:bit version (please complete the following information):
You can find this information in the lower right hand corner of the back of micro:bit (the side that says BBC micro:bit).
- Which version of the micro:
v2.21
Desktop (please complete the following information):
- OS:
Debian GNU/Linux 12 (bookworm)as container running on Windows 11 - Browser:
VSCode - Version:
1.80.2
Additional context
$ ls pxt_modules
core microphone radio
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
Reproduce the issue with the listed npm and pxt commands, then inspect how the pxt-microbit project exposes its TypeScript definitions, including the pxt_modules tree. Confirm that Math.map and Math.constrain are available to VSCode without ts(2339), and verify the result in the linked example project.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100