ConsoleTVs / sswr

🔥 Svelte stale while revalidate (SWR) data fetching strategy
MIT License
234 stars 11 forks source link

Cannot use `() => string` as key? #16

Closed frederikhors closed 3 years ago

frederikhors commented 3 years ago

Using this line:

$: ({ data, error } = useSWR(() => `${playerList}`, {...

Typescript throws with:

Argument of type '() => string' is not assignable to parameter of type 'string'.ts(2345).

Am I wrong?

ConsoleTVs commented 3 years ago

Hum.... https://github.com/ConsoleTVs/sswr/blob/master/src/index.ts#L14

The problem is here https://github.com/ConsoleTVs/sswr/blob/master/src/index.ts#L69

The default instance is not correct... I am going to fix this asap.

ConsoleTVs commented 3 years ago

Try the version 1.3.0

frederikhors commented 3 years ago

It works. Thanks!

Isn't the code on Github?

ConsoleTVs commented 3 years ago

Gonna upload, sorry