microsoft / microsoft/pxt-microbit

Missing TypeScript definitions in Math namespace

Open
#5,332 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

apis typescript
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

image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.