vercel-labs / vercel-labs/scriptc

how are number types inferred

Open
#18 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.9k
Forks
125
Avg merge
2h 14m
Merged PRs (30d)
95

Description

typescript has no explicit number types and all numbers in js are f64...can the ts->c compiler infer usage of u32 if it can prove that function calls only from say typedarrays and add the proper types? or will it just convert typedarray access to f64?
maybe this needs some sort of subset of the typescript language where u can optionally pass in proper number types instead of "number" to force the compiler to increase strictness...but then it wouldnt be typescript lol idk...or just fork typescript.
cuz i think v8 can do this where if it sees that u are calling method on u32 typed array, it will compile down to u32 in the assembly.

Contributor guide

No contributing guide indexed for this repository

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

The issue does not identify any files, tests, or compiler entry points to inspect. Clarify whether the goal is typed-array-specific numeric inference, optional explicit numeric types, or another design, and define the expected compiler output and acceptance tests before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.