[P2] Checker: primitive strings reject canonical numeric string-literal indices · Issue #2858 · nickna/SharpTS · GitHub
Skip to content

[P2] Checker: primitive strings reject canonical numeric string-literal indices #2858

Closed

Description

@nickna

The checker rejects canonical numeric string-literal indices on a statically typed primitive string.

const input: string = 'abc';
console.log(input['0'], input['3'] === undefined);

Strict TypeScript accepts this exact source. Node exits zero and prints a true. SharpTS rejects it at line 2 in both --no-tsconfig --noEmit and --no-tsconfig --strict --noLib --noEmit:

Index type '"0"' is not valid for indexing 'string'.

Both checker children exit 1 normally within their 20-second process-tree deadlines, with empty stderr and drained output. No interpretation, compilation, emission, assembly inspection or saved execution was attempted. The CLI output does not expose a numeric diagnostic code, so none is inferred here.

Found while validating #2798. Its complete stronger control independently rejects the typed quoted key '3' in both profiles; that whole source and its seven-line Node transcript remain preserved. #2798 owns runtime inherited-index lookup on an any receiver. #2799 owns runtime aliasing of noncanonical names. #2784 owns checker reads on actual Arrays; #527 is a closed keyof projection issue. Eight fresh all-state searches (all complete and untruncated) plus sixteen complete closest issue bodies and all comments found no focused owner for this primitive-string checker rejection.

Source lead: TypeChecker.Properties.Index.cs admits String/StringLiteral through the numeric-index branch, while the canonical string-literal special case handles Arrays only. The direct and delegated read paths have the same gap. Preserve precise string result types, noUncheckedIndexedAccess, invalid-name rejection and write checks. This is a source lead, not an introducing-commit claim.

Evidence: artifacts/p2-goal/2798-string-key-checker-node-oracle/canonical-quoted-string-indices.ts (SHA256 006C2BFE2E2EE6F5392D1346FDA43EBB79219A812555A163B037A1B3BBF0F3A7), fresh Node/strict reference results, and 2798-string-key-checker-current-proof/canonical-quoted-string-indices-results.json (SHA256 8D7FF940E2E4E2D1B244706C1C85B3BFB86D05755D35C7DD66BC98CEFA18B4BF). Owner audit: 2798-string-index-checker-owner-audit/assessment.json. Immutable CLI SHA256 ED665842B41DAE7A74D48CED3EAD012A5BDDE632F551CC778307E029C8FE94F4, corresponding to current clean commit 897033a580c0dc1c3c4c2c1e7842419c855d0d08; full runtime package and source hashes remained stable before and after each child. No production/test changes or project builds were made for this proof.

Activity

  1. added
    bugSomething isn't working
    priority: P2Normal: scoped correctness/compatibility fixes and planned feature or tooling work.
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: P2Normal: scoped correctness/compatibility fixes and planned feature or tooling work.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions