We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$nullable
$nonNull
Greetings!
I think this can be useful for the following reasons:
A quick example where the problem is present, I posted this on the server as well: https://kyse.link/COF71
As proof of concept, I cloned the repository and tweaked aggregate-function-builder.ts to add the following to see if it's gonna work:
aggregate-function-builder.ts
export class AggregateFunctionBuilder<DB, TB extends keyof DB, O = unknown> implements AliasableExpression<O> { // ... $nullable(): AggregateFunctionBuilder<DB, TB, O | null> { return new AggregateFunctionBuilder(this.#props) } }
and as far as I can tell, it gets the job done, so that when you use .$nullable(), the value is being inferred as {}[] | null.
.$nullable()
{}[] | null
The $notNull helper is also present in expression-wrapper.ts, json-path-builder.ts and raw-builder.ts, so I assume a potential new helper would also need to be added there.
$notNull
expression-wrapper.ts
json-path-builder.ts
raw-builder.ts
Anyway, don't want to make this too long, but let me know if this is a good idea or not, and have a great day.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Greetings!
I think this can be useful for the following reasons:
$nonNull
already exists, "where you know an expression can't be null, but Kysely is unable to infer it.".A quick example where the problem is present, I posted this on the server as well: https://kyse.link/COF71
As proof of concept, I cloned the repository and tweaked
aggregate-function-builder.ts
to add the following to see if it's gonna work:and as far as I can tell, it gets the job done, so that when you use
.$nullable()
, the value is being inferred as{}[] | null
.The
$notNull
helper is also present inexpression-wrapper.ts
,json-path-builder.ts
andraw-builder.ts
, so I assume a potential new helper would also need to be added there.Anyway, don't want to make this too long, but let me know if this is a good idea or not, and have a great day.
The text was updated successfully, but these errors were encountered: