Skip to content

slice() and Promise.resolve()/reject() with no arguments, toLocaleString(locales, options), iteration type names - #113

Merged
ASDAlexander77 merged 3 commits into
mainfrom
lib-gaps-tsc-sweep
Nov 21, 2026
Merged

ASDAlexander77 merged 3 commits into
mainfrom
lib-gaps-tsc-sweep

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Library gaps that TypeScript's compiler-tests sweep (compiler repo, scripts\tsc_compiler_tests.ps1) still hit.

  • String.prototype.slice(): indexStart is optional (default 0), in lib.d.ts (both places) and in lib.ts (__String.slice and the String wrapper class) — controlFlowWithIncompleteTypes.
  • Promise.resolve() / Promise.reject() with no argument: resolve<T = undefined>(value?: T); reject(reason?) throws undefined boxed in an any (undefined itself can't be thrown) — modulePreserveTopLevelAwait1, asyncFunctionContextuallyTypedReturns.
  • toLocaleString(locales?, options?) on arrays (new in __Array), TypedArray and ConvertingTypedArray, with a ToLocaleStringOptions interface. Taken but not applied (no locale data) — arrayToLocaleStringES2015/ES2020.
  • Iteration type names in types/lib.types.d.ts: IteratorResult (an alias, so a generator's next() matches it), Iterable, IterableIterator, Generator<T, TReturn, TNext>, AsyncIterator, AsyncIterable, AsyncIterableIterator, AsyncGenerator. Iterable/AsyncIterable are objects with next() (what for...of takes), not [Symbol.iterator]: a program's own interface Iterable<T> { next } merges with the library's, and the [Symbol.iterator] form broke compiler tests 00funcs_typed_generic_iterator / 01funcs_generic_iterator (both pass with this one).

New tests: string_slice_no_args, promise_no_args, array_toLocaleString, iteration_types.

What those sweep tests still fail on is the compiler's (handed to the compiler repo): flow narrowing of boolean | string in a loop, a generic lambda as an argument, tuples without array methods, arrays/strings as Iterable<T>, a yielded int vs a declared Generator<number>, next(value)/return()/throw(), and -mm=own generators typed as a non-library iterator interface of owned elements.

Tested (Windows, compiler 3f5ca0f0 = latest batch build): library rebuilt release + debug; tests.ps1 for gc / rc / none / own, release and debug, compiled and JIT: all pass (gc 246/247, rc 241, none 242, own 234; the rest are the usual skips); check_declarations: every declaration matches.

🤖 Generated with Claude Code

ASDAlexander77 and others added 3 commits November 21, 2026 09:58
…caleString(locales, options) on arrays

Library gaps TypeScript's compiler tests still hit:
- String.prototype.slice: indexStart is optional and defaults to 0, so slice() copies the string
  (controlFlowWithIncompleteTypes).
- Promise.resolve() gives a settled promise of nothing; Promise.reject() throws undefined, boxed
  in an any since undefined itself can't be thrown (modulePreserveTopLevelAwait1,
  asyncFunctionContextuallyTypedReturns).
- Arrays (new), TypedArray and ConvertingTypedArray toLocaleString take locales and options
  (ToLocaleStringOptions), not applied: there is no locale data (arrayToLocaleStringES2015/2020).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ck_declarations)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erator and the async ones

TypeScript code names these types (the compiler-tests sweep: "generic type Iterable/Generator/
AsyncGenerator can't be found"). Here they fit the generators this compiler makes:
- IteratorResult<T, TReturn> is an alias of IterateResult<T>: as an interface a generator's next()
  did not match it.
- Iterable<T> / AsyncIterable<T> are objects with next(), as for...of takes them, not objects with
  [Symbol.iterator]: a generator has none, and an interface Iterable<T> { next } declared in a
  program merges with the library's (two compiler tests declare one).
- Generator<T, TReturn, TNext>, IterableIterator<T>, AsyncGenerator, AsyncIterableIterator,
  AsyncIterator: next() of their own; TReturn and TNext are taken, not used.

Not yet, in the compiler: an array or a string as an Iterable<T>, a yielded int as a declared
number, next(value), return() and throw(); under -mm=own a generator of owned elements returned
as an interface declared outside the library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 9438a0d into main Nov 21, 2026
10 checks passed
@ASDAlexander77
ASDAlexander77 deleted the lib-gaps-tsc-sweep branch November 21, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant