jsx-eslint/jsx-ast-utils

The prop value with an expression type of TSSatisfiesExpression could not be resolved.

Opened this issue · 5 comments

Receiving the error:

The prop value with an expression type of TSSatisfiesExpression could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.

During local builds of NextJS application.

ljharb commented

Thanks! I believe that's pretty new in TS. Can you provide some code that uses satisfies?

Same problem for me for a couple of months, sorry I didn't take the time to report it earlier. Here is an example of a code where eslint complain:

type FormData = {
  name: string;
}

function Input() {
  return <input type="text" name={"name" satsifies keyof FormData} />
}

It seems that it gives the error when a prop mix the expected type with a satisfies in it.

I’m getting the same issue here, we also have some inputs we want to make sure are correct: name={'fieldName' satisfies keyof Fields}

We make extensive use of satisfies and the only places we see this issue are the places where we use this string satisifes keyof Type pattern

mifi commented

Did anyone find a workaround? does TS have any other keyword that can be used instead of satisfies (inline in JSX)? I know of as but it's unsafe and cannot be used here

The fix for this in this package isn’t hard, but getting the tests to run on a new enough TS version so it can be tested is, unfortunately.

@mifi there’s no way to have the safety of that TS feature without using the feature, i believe.