[oracledb] Correct callback style type definition to allow error as null and optional return value for success#74833
Conversation
|
@sudarshan12s Thank you for submitting this PR! This is a live comment that I will keep updated. 1 package in this PR
Code ReviewsBecause this is a widely-used package, a DT maintainer will need to review it before it can be merged. You can test the changes of this PR in the Playground. Status
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 74833,
"author": "sudarshan12s",
"headCommitOid": "0760be2912c3a881a3d9a459318d7f54bec2c876",
"mergeBaseOid": "8fe0c8af85c80359cf96a19fb00e423332cf700f",
"lastPushDate": "2026-04-03T06:45:15.000Z",
"lastActivityDate": "2026-04-14T16:10:58.000Z",
"mergeOfferDate": "2026-04-14T15:29:17.000Z",
"mergeRequestDate": "2026-04-14T16:10:58.000Z",
"mergeRequestUser": "sudarshan12s",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "oracledb",
"kind": "edit",
"files": [
{
"path": "types/oracledb/index.d.ts",
"kind": "definition"
},
{
"path": "types/oracledb/oracledb-tests.ts",
"kind": "test"
}
],
"owners": [
"connorjayfitzgerald",
"dannyb648",
"jacobwheale",
"sudarshan12s",
"sharadraju"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "RyanCavanaugh",
"date": "2026-04-14T15:28:32.000Z",
"isMaintainer": true
},
{
"type": "approved",
"reviewer": "sharadraju",
"date": "2026-04-14T08:01:30.000Z",
"isMaintainer": false
}
],
"mainBotCommentID": 4182178808,
"ciResult": "pass"
} |
|
🔔 @connorjayfitzgerald @dannyb648 @jacobwheale @sharadraju — please review this PR in the next few days. Be sure to explicitly select |
RyanCavanaugh
left a comment
There was a problem hiding this comment.
Typically someone using an optional parameter in a callback position is mistakenly thinking that it means "is allowed to be ignored by the callee", not "is allowed to be unprovided by the caller". It'd be clearer if all these used | undefined instead.
|
@sudarshan12s One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you! |
Thanks @RyanCavanaugh . If I understand correctly, you're suggesting changing the callback to:
node-oracledb driver on error invokes the callback with a single argument: (second arg is not sent or remains optional) on Success with 2 args: Let me know if I should prefer the stricter (pool: Pool | undefined) for consistency. |
|
For that case you can use a spread tuple: function foo(cb: (...args: [string] | [null, Error]) => void) { |
If I use above syntax for:
I get the following lint error: I can instead use: I can then use ResultCallback at all the places applicable ( Does this approach look reasonable? Thanks. |
|
You should suppress that lint warning, it's a false positive |
|
@RyanCavanaugh Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
Thanks. I have suppressed the warning and made changes , can you take a look .. |
|
Re-ping @connorjayfitzgerald, @dannyb648, @jacobwheale: This PR has been out for over a week, yet I haven't seen any reviews. Could someone please give it some attention? Thanks! |
|
@sudarshan12s: Everything looks good here. I am ready to merge this PR (at 0760be2) on your behalf whenever you think it's ready. If you'd like that to happen, please post a comment saying:
and I'll merge this PR almost instantly. Thanks for helping out! ❤️ (@connorjayfitzgerald, @dannyb648, @jacobwheale, @sharadraju: you can do this too.) |
|
Ready to merge |
This fixes the issue reported here
It fixes the callback style type definition for all the APIs accepting callbacks.
Please fill in this template.
pnpm test <package to test>.Select one of these and delete the others:
If adding a new definition:
.d.tsfiles generated via--declarationdts-gen --dt, not by basing it on an existing project.tsconfig.jsonshould havenoImplicitAny,noImplicitThis,strictNullChecks, andstrictFunctionTypesset totrue.If changing an existing definition:
package.json.If removing a declaration:
notNeededPackages.json.