[@types/node] Fix type definitions for node:url#68456
[@types/node] Fix type definitions for node:url#68456typescript-bot merged 1 commit intomasterfrom unknown repository
node:url#68456Conversation
|
@codershiba Thank you for submitting this PR! This is a live comment which 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": 68456,
"author": "codershiba",
"headCommitOid": "39170046424a5f92a82ea604860cbe7066b7bd7e",
"mergeBaseOid": "8eef7f48da3124d97c81e44063de0b35729a9064",
"lastPushDate": "2024-02-03T05:07:57.000Z",
"lastActivityDate": "2024-02-15T09:41:55.000Z",
"mergeOfferDate": "2024-02-11T13:38:25.000Z",
"mergeRequestDate": "2024-02-15T09:41:55.000Z",
"mergeRequestUser": "codershiba",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "node",
"kind": "edit",
"files": [
{
"path": "types/node/test/url.ts",
"kind": "test"
},
{
"path": "types/node/ts4.8/test/url.ts",
"kind": "test"
},
{
"path": "types/node/ts4.8/url.d.ts",
"kind": "definition"
},
{
"path": "types/node/ts4.8/wasi.d.ts",
"kind": "definition"
},
{
"path": "types/node/url.d.ts",
"kind": "definition"
},
{
"path": "types/node/v16/test/url.ts",
"kind": "test"
},
{
"path": "types/node/v16/ts4.8/test/url.ts",
"kind": "test"
},
{
"path": "types/node/v16/ts4.8/url.d.ts",
"kind": "definition"
},
{
"path": "types/node/v16/url.d.ts",
"kind": "definition"
},
{
"path": "types/node/v18/test/url.ts",
"kind": "test"
},
{
"path": "types/node/v18/ts4.8/test/url.ts",
"kind": "test"
},
{
"path": "types/node/v18/ts4.8/url.d.ts",
"kind": "definition"
},
{
"path": "types/node/v18/url.d.ts",
"kind": "definition"
},
{
"path": "types/node/wasi.d.ts",
"kind": "definition"
}
],
"owners": [
"Microsoft",
"jkomyno",
"alvis",
"r3nya",
"btoueg",
"smac89",
"touffy",
"DeividasBakanas",
"eyqs",
"Hannes-Magnusson-CK",
"hoo29",
"kjin",
"ajafff",
"islishude",
"mwiktorczyk",
"mohsen1",
"n-e",
"galkin",
"parambirs",
"eps1lon",
"ThomasdenH",
"WilcoBakker",
"wwwy3y3",
"samuela",
"kuehlein",
"bhongy",
"chyzwar",
"trivikr",
"yoursunny",
"qwelias",
"ExE-Boss",
"peterblazejewicz",
"addaleax",
"victorperin",
"ZYSzys",
"NodeJS",
"LinusU",
"wafuwafu13",
"mcollina",
"Semigradsky"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "Anonymous4078",
"date": "2024-02-12T18:54:50.000Z",
"isMaintainer": false
},
{
"type": "approved",
"reviewer": "peterblazejewicz",
"date": "2024-02-11T13:37:46.000Z",
"isMaintainer": true
},
{
"type": "stale",
"reviewer": "jakebailey",
"date": "2024-02-06T10:37:39.000Z",
"abbrOid": "81f254c"
},
{
"type": "stale",
"reviewer": "ExE-Boss",
"date": "2024-02-03T06:38:50.000Z",
"abbrOid": "4da0f85"
}
],
"mainBotCommentID": 1925101032,
"ciResult": "pass"
} |
|
🔔 @microsoft @jkomyno @alvis @r3nya @btoueg @smac89 @Touffy @DeividasBakanas @eyqs @Hannes-Magnusson-CK @hoo29 @kjin @ajafff @islishude @mwiktorczyk @mohsen1 @n-e @galkin @parambirs @eps1lon @ThomasdenH @WilcoBakker @wwwy3y3 @samuela @kuehlein @bhongy @chyzwar @trivikr @yoursunny @qwelias @ExE-Boss @peterblazejewicz @addaleax @victorperin @ZYSzys @nodejs @LinusU @wafuwafu13 @mcollina @Semigradsky — please review this PR in the next few days. Be sure to explicitly select |
|
@ExE-Boss 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? |
|
I'm quite sure that I've seen discussions on this before, but I cannot find it now 🤔 The ref: https://nodejs.org/api/url.html#new-urlinput-base There are quite a few other apis that does this, but I don't think that any of them are typed as accepting anything else than I don't have a strong opinion either way, but this should probably at least be kept aligned with what the TypeScript DOM typings are doing 🤔 (edit: seems like the TypeScript supplied |
|
I'd like to point, that in other places, e.g. MIMEType constructor accepts: constructor(input: string | { toString: () => string });I'd use |
Is the approach taken by the PR not correct? |
No, not at all. Just raised how same problem was solved in other places. TS is all about the shape, so MIMEType approach works too. I'd stick to dom library approach though (where people look for?). So for me PR approach is perfectly sound |
|
With the approach constructor(input: string | { toString: () => string });TS should error in the following examples but it doesn't new URL(9); ❌
new URL([]); ❌Now with the current approach constructor(input: string | URL);new URL(9); // Errors as expected ✅
new URL([]); // Errors as expected ✅ |
I understand, but this example is copied straight from Node docs: const myURL = new URL({ toString: () => 'https://example.org/' });
// https://example.org/I'd go to align with |
|
@jakebailey @sandersn Can you take a look here? |
|
Not sure why we're being pinged in particular; is the above feedback in question? |
Yeah, would like to know what you think about the PR and how I should move forward. |
|
I mean, I think it's moderately unfortunate to be able to pass in anything, but matching DOM and working with a documented example seems preferable. |
|
@codershiba The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
URL constructor accept URLnode:url
|
@jakebailey, @ExE-Boss 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? |
|
@peterblazejewicz Can you take a look here? |
|
so we are sticking that would be nice to have those aligned to |
I have done some changes few days ago, can you see if that's okay or more changes needs to be done |
peterblazejewicz
left a comment
There was a problem hiding this comment.
LGTM!
@codershiba thanks!
|
@codershiba: Everything looks good here. I am ready to merge this PR (at 3917004) 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! ❤️ (@microsoft, @jkomyno, @alvis, @r3nya, @btoueg, @smac89, @Touffy, @DeividasBakanas, @eyqs, @Hannes-Magnusson-CK, @hoo29, @kjin, @ajafff, @islishude, @mwiktorczyk, @mohsen1, @n-e, @galkin, @parambirs, @eps1lon, @ThomasdenH, @WilcoBakker, @wwwy3y3, @samuela, @kuehlein, @bhongy, @chyzwar, @trivikr, @yoursunny, @qwelias, @ExE-Boss, @peterblazejewicz, @addaleax, @victorperin, @ZYSzys, @nodejs, @LinusU, @wafuwafu13, @mcollina, @Semigradsky: you can do this too.) |
|
Ready to merge |
* feat!: Standardize `baseURL` - Remove long-deprecated `baseUrl` - Use proper `base` URL logic via `new URL(url, base)` * refactor: Use updated `URL` types via: - DefinitelyTyped/DefinitelyTyped#68454 - DefinitelyTyped/DefinitelyTyped#68456 * chore: pin `karma-webpack`
* feat!: Standardize `baseURL` - Remove long-deprecated `baseUrl` - Use proper `base` URL logic via `new URL(url, base)` * refactor: Use updated `URL` types via: - DefinitelyTyped/DefinitelyTyped#68454 - DefinitelyTyped/DefinitelyTyped#68456 * chore: pin `karma-webpack`
Fixes #68454
Please fill in this template.
pnpm test node.If changing an existing definition:
package.json.