kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
10.36k stars 263 forks source link

Autocomplete issue with TS 5.0.2 #876

Open wirekang opened 7 months ago

wirekang commented 7 months ago

In Typescript 5.0.2, autocomplete is not working with certain form of selecting:

db.selectFrom("table").select((e) => [
  "", // HERE
]);

Type checking works well, only autocomplete(suggestion) is disabled.

ts kysely works?
5.0.2 0.27.2 X playground
5.0.2 0.27.1 X
5.0.2 0.27.0 X
5.0.2 0.26.3 X
5.0.2 0.26.2 O playground
5.0.2 0.26.1 O

This is probably an issue of Typescript itself since it's gone with latest version of Typescript:

ts kysely works?
5.3.3 0.27.2 O
5.3.3 0.27.1 O
5.3.3 0.27.0 O
5.3.3 0.26.3 O
5.3.3 0.26.2 O
5.3.3 0.26.1 O

But it would be great if Kysely has a type backward compatibility. I'm getting trouble with Monaco Editor because they are strongly bonded with fixed version of TS: current stable one is 5.0.2.

tsconfig.json

{
  "compilerOptions": {
    "strict": true,
    "noImplicitAny": true
  }
}
wirekang commented 7 months ago

Looks like this commit is related.

koskimas commented 7 months ago

The ironic thing is that that specific commit fixed the same issue for the newer typescript versions. These autocompletion things can't be automatically tested. Manually checking against a bunch of typescript versions is too much work.

wirekang commented 7 months ago

Ok, it would be better to close this issue. I hate monaco editor.

koskimas commented 7 months ago

I could try to figure out a way to support two versions: the latest and the one monaco is using. But I'm not sure I'll succeed. It was a shitload of trial and error to fix this for the latest versions already 😅

I'll reopen this for now.