Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[P2] Compiler: absent Promise instance properties read as null instead of undefined

Open Beginner friendly
#2,704 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp, typescript
Domain
compilers

Research direction

Start in Compilation/RuntimeEmitter.Objects.Properties.cs, where the Promise property handler returns null for unknown properties. Compare that branch with the emitted undefined sentinel and check that present properties and genuine null values keep their behavior. Use the supplied Promise reproduction and controls; done when compiled execution matches Node and interpreted execution for the missing-property checks.

Written by the indexing model from the issue text.

Description

bug priority: P2

Reading an absent property on an untouched Promise returns null in compiled execution, rather than JavaScript undefined. Intrinsic and guest-subclass Promise receivers both reproduce.

const promise: any = Promise.resolve(1);
console.log(promise.missing === undefined, promise.missing === null,
    typeof promise.missing, Object.hasOwn(promise, "missing"));

Strict TypeScript accepts. Node v22.23.2 and immutable checked interpretation print:

true false undefined false

The same immutable compiler saves a standalone assembly that passes full IL verification before execution, then prints:

false true object false

A separate minimal control uses new P(resolve => resolve(1)) where class P extends Promise<number> {}; it has the same compiled-only failure. The otherwise equivalent ordinary-object read from {} is correct in all paths. Neither source writes any property, installs a descriptor, awaits a value, uses a Symbol, or invokes the missing member.

Source lead: Compilation/RuntimeEmitter.Objects.Properties.cs ends its Promise property handler with the explicit // Unknown promise property - return null branch and Ldnull/Ret. An absent property must return the emitted undefined sentinel while preserving genuine null data values and present accessor behavior.

Found while fixing interpreter #2545, which concerns computed Promise writes. Fresh all-state searches for Promise missing/absent/null property reads found no focused owner. Read #2436: that report specifically owns PRESENT getterless Promise accessor descriptors and undefined getter sentinels; this source has no descriptor at all. Closed #651 is expressly limited to missing function/arrow properties, and #1778 to TypeScript namespace objects. No introducing-commit claim.

Proof: artifacts/p2-interpreter/2545-missing-promise-own-read-results.json, exact 2545-missing-promise-own-read.ts (SHA256 7BFB59CE83106A2DB04D13F37123908EF8AC48D72D77ADCB1994C45E17C81B16), 2545-missing-promise-own-read-controls.ts, and adjacent strict-TypeScript/Node/interpreted/compile/saved-execution logs. Fresh dedup and related bodies are 2545-missing-promise-read-* plus the full #2436 body in 2545-related-2436.json.

Immutable baseline CLI SHA256 B5FA2CADDEA116B83166442205B825130A663B682EDAABAA1312A26FB7909E85 was checked unchanged before and after the probes. Interpretation used --no-tsconfig --noLib; compilation additionally used --compile ... --standalone --verify. Both saved outputs executed only after compile exit zero, the complete IL verification passed. marker, and no warning or unsupported-runtime note. Every process exited zero without timing out. No project build or production edit was performed.

Dominant language
C#
Stars
156
Forks
4
Avg merge
4h 14m
Merged PRs (30d)
89

Getting set up

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.

More from nickna/SharpTS

All issues in nickna/SharpTS

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.