Skip to content

Version 1.1.31#1585

Merged
sinclairzx81 merged 3 commits into
mainfrom
notice
Apr 22, 2026
Merged

Version 1.1.31#1585
sinclairzx81 merged 3 commits into
mainfrom
notice

Conversation

@sinclairzx81
Copy link
Copy Markdown
Owner

@sinclairzx81 sinclairzx81 commented Apr 22, 2026

This PR adds deprecation notices for Awaited, Promise, AsyncIterator, Iterator.

The Promise, AsyncIterator and Iterator types are considered higher-order types whose functions and signatures can technically be expressed by the 1.x type system. In addition, these types are not entirely portable to languages that lack asynchronous primitives, or iterators. As these types add a lot of overhead for very little utility, a decision has been made to remove them in the next version.

The Awaited action is being removed as Promise is no longer supported. An Awaited fallback may be possible via Type.Generic + Recursive Unwrap, but would not have the same inference performance as the native supported version. A fallback may be considered for the next version regardless.

Promise

The following is the planned fallback for Promise

export function Promise<Type extends Type.TSchema>
 (_type: Type): Type.TUnsafe<globalThis.Promise<Type.Static<Type>>> {
  return Type.Refine(Type.Object({}), 
    value => value instanceof globalThis.Promise,
    () => `Expected Promise`) as never
}

AsyncIterator

The following is the planned fallback for AsyncIterator

export function AsyncIterator<Type extends Type.TSchema>
  (_type: Type): Type.TUnsafe<globalThis.AsyncIterableIterator<Type.Static<Type>>> {
  return Type.Refine(Type.Object({}), 
    value => Symbol.asyncIterator in value,
    () => `Expected AsyncIterator`) as never
}

Iterator

The following is the planned fallback for Iterator

export function Iterator<Type extends Type.TSchema>
  (_type: Type): Type.TUnsafe<globalThis.IterableIterator<Type.Static<Type>>> {
  return Type.Refine(Type.Object({}), 
    value => Symbol.iterator in value,
    () => `Expected Iterator`) as never
}

These types are being removed to add a degree of cross language interoperability, and to reduce overall library bundle size. These types were originally added to express RPC interface return types, but have not be utilized in years. Their omission is considered to be low impact.

@sinclairzx81 sinclairzx81 merged commit 6de45fd into main Apr 22, 2026
6 checks passed
@sinclairzx81 sinclairzx81 deleted the notice branch April 22, 2026 09:56
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