Skip to content

💅 Type-aware rules ~55ms per expression on a recursive conditional type since 2.5.13 (#11620) #11813

Description

@AlbinoGeek

Environment information

Details
CLI:
  Version:                      2.5.14

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_DISTRIBUTION:                npm
  JS_RUNTIME_VERSION:           v24.18.0
  JS_RUNTIME_NAME:              node

Linter:
  Enabled rules:
    suspicious/noUnnecessaryConditions
    nursery/noFloatingPromises
    nursery/noMisusedPromises

Rule name

nursery/noFloatingPromises, nursery/noMisusedPromises, suspicious/noUnnecessaryConditions

Playground link

https://github.com/AlbinoGeek/biome-recursive-conditional-type-slowdown

interface Api { get(): number }
type Rec<T, L> = L extends [] ? T : Rec<T, []>;
declare const api: Rec<Api, []>;
api.get(); // x20
Rule (--only) 2.5.12 2.5.13 2.5.14
noFloatingPromises 2ms 1149ms 1122ms
noMisusedPromises 3ms 1127ms 1110ms
noUnnecessaryConditions 3ms 1115ms 1126ms
Build Time
23aad6df8 (parent of #11620) 9ms
20e513af6 (#11620) 1131ms

Non-recursive L extends [] ? T : never stays at 1.6ms. Real-world source: zustand create<T>() (Mutate<StoreApi<T>, []>), every getState(). #11620 was the fix for #11534. Not the same as #11810 (#11780).

Expected result

Same as 2.5.12 (a few ms).

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-Type-InferenceArea: type inferenceS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions