Skip to content

Jest 30 + MobX TS issue #4581

@AndrewSouthpaw

Description

@AndrewSouthpaw

It looks like the latest Jest v30 types are incompatible with MobX.

  • "@types/jest": "~30.0.0"
  • "jest": "~30.1.3"
  • "mobx": "~6.13.7"

Here's some sample code that will cause a type error:

const initial = new ObservableSet<string>(["foo", "bar"])
const updated = new ObservableSet<string>(initial)

With the new @types/jest version, we get this type error:

error TS2345: Argument of type 'ObservableSet<string>' is not assignable to parameter of type 'IObservableSetInitialValues<string> | undefined'.
  Type 'ObservableSet<string>' is not assignable to type 'Set<string>'.
    The types returned by 'entries()' are incompatible between these types.
      Property '[Symbol.dispose]' is missing in type 'IterableIterator<[string, string]>' but required in type 'SetIterator<[string, string]>'.

If I downgrade to "@types/jest": "~29.5.14", the problem goes away.

I'm not entirely sure this is a mobx problem, but it does seem to only be happening on mobx values from the spot checking I've done so far.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions