Skip to content

"Excessive stack depth comparing types" when linting @sinclair/typebox@0.27.8 #1730

@nicolo-ribaudo

Description

@nicolo-ribaudo

Steps to reproduce

./node_modules/.bin/typescript node_modules/@sinclair/typebox/typebox.d.ts

Behavior with typescript@5.8

No errors

Behavior with tsgo

node_modules/@sinclair/typebox/typebox.d.ts:137:63 - error TS2321: Excessive stack depth comparing types 'UnionToTuple<{ [K in T]: TLiteral<K>; }[T], UnionLast<{ [K in T]: TLiteral<K>; }[T]>>' and 'TSchema[]'.

137 export type TExcludeTemplateLiteralResult<T extends string> = TUnionResult<Assert<UnionToTuple<{
                                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138     [K in T]: TLiteral<K>;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
139 }[T]>, TSchema[]>>;
    ~~~~~~~~~~~~~~~~~~

node_modules/@sinclair/typebox/typebox.d.ts:145:63 - error TS2321: Excessive stack depth comparing types 'UnionToTuple<{ [K in T]: TLiteral<K>; }[T], UnionLast<{ [K in T]: TLiteral<K>; }[T]>>' and 'TSchema[]'.

145 export type TExtractTemplateLiteralResult<T extends string> = TUnionResult<Assert<UnionToTuple<{
                                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146     [K in T]: TLiteral<K>;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
147 }[T]>, TSchema[]>>;
    ~~~~~~~~~~~~~~~~~~

node_modules/@sinclair/typebox/typebox.d.ts:380:102 - error TS2321: Excessive stack depth comparing types 'UnionToTuple<{ [K in S]: TLiteral<K>; }[S], UnionLast<{ [K in S]: TLiteral<K>; }[S]>>' and 'TLiteral<TLiteralValue>[]'.

380 export type TUnionTemplateLiteral<T extends TTemplateLiteral, S extends string = Static<T>> = Ensure<TUnionResult<Assert<UnionToTuple<{
                                                                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
381     [K in S]: TLiteral<K>;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
382 }[S]>, TLiteral[]>>>;
    ~~~~~~~~~~~~~~~~~~~


Found 3 errors in the same file, starting at: node_modules/@sinclair/typebox/typebox.d.ts:137

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions