@types/node 18.6.0 → 18.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. node/README.md +1 -1
  2. node/fs.d.ts +21 -7
  3. node/package.json +2 -2
  4. node/path.d.ts +30 -19
  5. node/stream.d.ts +12 -0
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sun, 24 Jul 2022 17:02:19 GMT
11
+ * Last updated: Sat, 30 Jul 2022 21:02:20 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/fs.d.ts CHANGED
@@ -3791,7 +3791,7 @@ declare module 'fs' {
3791
3791
  export interface StatSyncOptions extends StatOptions {
3792
3792
  throwIfNoEntry?: boolean | undefined;
3793
3793
  }
3794
- export interface CopyOptions {
3794
+ interface CopyOptionsBase {
3795
3795
  /**
3796
3796
  * Dereference symlinks
3797
3797
  * @default false
@@ -3803,11 +3803,6 @@ declare module 'fs' {
3803
3803
  * @default false
3804
3804
  */
3805
3805
  errorOnExist?: boolean;
3806
- /**
3807
- * Function to filter copied files/directories. Return
3808
- * `true` to copy the item, `false` to ignore it.
3809
- */
3810
- filter?(source: string, destination: string): boolean;
3811
3806
  /**
3812
3807
  * Overwrite existing file or directory. _The copy
3813
3808
  * operation will ignore errors if you set this to false and the destination
@@ -3826,6 +3821,25 @@ declare module 'fs' {
3826
3821
  * @default false
3827
3822
  */
3828
3823
  recursive?: boolean;
3824
+ /**
3825
+ * When true, path resolution for symlinks will be skipped
3826
+ * @default false
3827
+ */
3828
+ verbatimSymlinks?: boolean;
3829
+ }
3830
+ export interface CopyOptions extends CopyOptionsBase {
3831
+ /**
3832
+ * Function to filter copied files/directories. Return
3833
+ * `true` to copy the item, `false` to ignore it.
3834
+ */
3835
+ filter?(source: string, destination: string): boolean | Promise<boolean>;
3836
+ }
3837
+ export interface CopySyncOptions extends CopyOptionsBase {
3838
+ /**
3839
+ * Function to filter copied files/directories. Return
3840
+ * `true` to copy the item, `false` to ignore it.
3841
+ */
3842
+ filter?(source: string, destination: string): boolean;
3829
3843
  }
3830
3844
  /**
3831
3845
  * Asynchronously copies the entire directory structure from `src` to `dest`,
@@ -3851,7 +3865,7 @@ declare module 'fs' {
3851
3865
  * @param src source path to copy.
3852
3866
  * @param dest destination path to copy to.
3853
3867
  */
3854
- export function cpSync(source: string | URL, destination: string | URL, opts?: CopyOptions): void;
3868
+ export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
3855
3869
  }
3856
3870
  declare module 'node:fs' {
3857
3871
  export * from 'fs';
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.6.0",
3
+ "version": "18.6.3",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -220,6 +220,6 @@
220
220
  },
221
221
  "scripts": {},
222
222
  "dependencies": {},
223
- "typesPublisherContentHash": "d28a87b65426fa8c6dbbc6c18b42b7d50ad6446c979e625735a3ae1db8ec9334",
223
+ "typesPublisherContentHash": "a45b99c264e1706eba94977d321e75c5bad5d3e7259ab60aa5a3e4a0926bcb60",
224
224
  "typeScriptVersion": "4.0"
225
225
  }
node/path.d.ts CHANGED
@@ -69,18 +69,19 @@ declare module 'path' {
69
69
  * Normalize a string path, reducing '..' and '.' parts.
70
70
  * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
71
71
  *
72
- * @param p string path to normalize.
72
+ * @param path string path to normalize.
73
+ * @throws {TypeError} if `path` is not a string.
73
74
  */
74
- normalize(p: string): string;
75
+ normalize(path: string): string;
75
76
  /**
76
77
  * Join all arguments together and normalize the resulting path.
77
- * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
78
78
  *
79
79
  * @param paths paths to join.
80
+ * @throws {TypeError} if any of the path segments is not a string.
80
81
  */
81
82
  join(...paths: string[]): string;
82
83
  /**
83
- * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
84
+ * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
84
85
  *
85
86
  * Starting from leftmost {from} parameter, resolves {to} to an absolute path.
86
87
  *
@@ -89,41 +90,50 @@ declare module 'path' {
89
90
  * the current working directory is used as well. The resulting path is normalized,
90
91
  * and trailing slashes are removed unless the path gets resolved to the root directory.
91
92
  *
92
- * @param pathSegments string paths to join. Non-string arguments are ignored.
93
+ * @param paths A sequence of paths or path segments.
94
+ * @throws {TypeError} if any of the arguments is not a string.
93
95
  */
94
- resolve(...pathSegments: string[]): string;
96
+ resolve(...paths: string[]): string;
95
97
  /**
96
98
  * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
97
99
  *
100
+ * If the given {path} is a zero-length string, `false` will be returned.
101
+ *
98
102
  * @param path path to test.
103
+ * @throws {TypeError} if `path` is not a string.
99
104
  */
100
- isAbsolute(p: string): boolean;
105
+ isAbsolute(path: string): boolean;
101
106
  /**
102
- * Solve the relative path from {from} to {to}.
107
+ * Solve the relative path from {from} to {to} based on the current working directory.
103
108
  * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
109
+ *
110
+ * @throws {TypeError} if either `from` or `to` is not a string.
104
111
  */
105
112
  relative(from: string, to: string): string;
106
113
  /**
107
114
  * Return the directory name of a path. Similar to the Unix dirname command.
108
115
  *
109
- * @param p the path to evaluate.
116
+ * @param path the path to evaluate.
117
+ * @throws {TypeError} if `path` is not a string.
110
118
  */
111
- dirname(p: string): string;
119
+ dirname(path: string): string;
112
120
  /**
113
121
  * Return the last portion of a path. Similar to the Unix basename command.
114
122
  * Often used to extract the file name from a fully qualified path.
115
123
  *
116
- * @param p the path to evaluate.
124
+ * @param path the path to evaluate.
117
125
  * @param ext optionally, an extension to remove from the result.
126
+ * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
118
127
  */
119
- basename(p: string, ext?: string): string;
128
+ basename(path: string, ext?: string): string;
120
129
  /**
121
130
  * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
122
- * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string
131
+ * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
123
132
  *
124
- * @param p the path to evaluate.
133
+ * @param path the path to evaluate.
134
+ * @throws {TypeError} if `path` is not a string.
125
135
  */
126
- extname(p: string): string;
136
+ extname(path: string): string;
127
137
  /**
128
138
  * The platform-specific file separator. '\\' or '/'.
129
139
  */
@@ -135,15 +145,16 @@ declare module 'path' {
135
145
  /**
136
146
  * Returns an object from a path string - the opposite of format().
137
147
  *
138
- * @param pathString path to evaluate.
148
+ * @param path path to evaluate.
149
+ * @throws {TypeError} if `path` is not a string.
139
150
  */
140
- parse(p: string): ParsedPath;
151
+ parse(path: string): ParsedPath;
141
152
  /**
142
153
  * Returns a path string from an object - the opposite of parse().
143
154
  *
144
- * @param pathString path to evaluate.
155
+ * @param pathObject path to evaluate.
145
156
  */
146
- format(pP: FormatInputPathObject): string;
157
+ format(pathObject: FormatInputPathObject): string;
147
158
  /**
148
159
  * On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
149
160
  * If path is not a string, path will be returned without modifications.
node/stream.d.ts CHANGED
@@ -519,6 +519,18 @@ declare module 'stream' {
519
519
  * @since v0.9.4
520
520
  */
521
521
  class Writable extends Stream implements NodeJS.WritableStream {
522
+ /**
523
+ * A utility method for creating a `Writable` from a web `WritableStream`.
524
+ * @since v17.0.0
525
+ * @experimental
526
+ */
527
+ static fromWeb(writableStream: streamWeb.WritableStream, options?: Pick<WritableOptions, 'decodeStrings' | 'highWaterMark' | 'objectMode' | 'signal'>): Writable;
528
+ /**
529
+ * A utility method for creating a web `WritableStream` from a `Writable`.
530
+ * @since v17.0.0
531
+ * @experimental
532
+ */
533
+ static toWeb(streamWritable: Writable): streamWeb.WritableStream;
522
534
  /**
523
535
  * Is `true` if it is safe to call `writable.write()`, which means
524
536
  * the stream has not been destroyed, errored or ended.