Skip to content

Commit

Permalink
[Tech] Patch @types/node to restrict our platform type to valid p…
Browse files Browse the repository at this point in the history
…latforms (#3927)

Patch `@types/node` to restrict our `platform` type to valid platforms
  • Loading branch information
CommandMC authored Nov 18, 2024
1 parent 2cc9cae commit 976b489
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 55 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,10 @@
},
"resolutions": {
"ts-morph": "17.0.1"
},
"pnpm": {
"patchedDependencies": {
"@types/node": "patches/@types__node.patch"
}
}
}
45 changes: 45 additions & 0 deletions patches/@types__node.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
diff --git a/process.d.ts b/process.d.ts
index 5f84863f9b4824dd1bd753726e6cbb3813fe358e..0c8f938a9cb5b807cf7415356ca064495b13cce7 100644
--- a/process.d.ts
+++ b/process.d.ts
@@ -66,17 +66,9 @@ declare module "process" {
openssl: string;
}
type Platform =
- | "aix"
- | "android"
| "darwin"
- | "freebsd"
- | "haiku"
| "linux"
- | "openbsd"
- | "sunos"
| "win32"
- | "cygwin"
- | "netbsd";
type Architecture =
| "arm"
| "arm64"
@@ -1258,12 +1250,8 @@ declare module "process" {
*
* Currently possible values are:
*
- * * `'aix'`
* * `'darwin'`
- * * `'freebsd'`
* * `'linux'`
- * * `'openbsd'`
- * * `'sunos'`
* * `'win32'`
*
* ```js
@@ -1271,9 +1259,6 @@ declare module "process" {
*
* console.log(`This platform is ${platform}`);
* ```
- *
- * The value `'android'` may also be returned if the Node.js is built on the
- * Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os).
* @since v0.1.16
*/
readonly platform: Platform;
Loading

0 comments on commit 976b489

Please sign in to comment.