Next.js Discord

Discord Forum

`satisfies` breaks NextJS compilation - why?

Unanswered
Golden northern bumble bee posted this in #help-forum
Open in Discord
Golden northern bumble beeOP
For some reason I cannot build a NextJS app once I start using the satisfies operator.
Example:
type Foo = {
  foo: unknown;
};

function bar() {
  return {
    foo: 1,
  } satisfies Foo;
}

Error message:
error - ./src/components/common/amendment-adapter-store.tsx:10:4
Syntax error: Unexpected token, expected ","

   8 |   return ({
   9 |     foo: 1
> 10 |   } satisfies Foo);
 ****


Ideas?

1 Reply

Dwarf Crocodile
Check typescript version in your package.json file.
The satisfies operator was added on TypeScript version 4.9