Skip to content

Commit b20af80

Browse files
committed
util: introduce util.types.is[…] type checks
Provide public APIs for native typechecking that is actually useful. The motivation for this is providing alternatives to userland modules that would currently rely on `process.binding('util')`. PR-URL: #18415 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
1 parent bd6e0be commit b20af80

File tree

15 files changed

+919
-125
lines changed

15 files changed

+919
-125
lines changed

doc/api/deprecations.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,14 @@ Using the `noAssert` argument has no functionality anymore. All input is going
932932
to be verified, no matter if it is set to true or not. Skipping the verification
933933
could lead to hard to find errors and crashes.
934934
935+
<a id="DEP0XXX"></a>
936+
### DEP0XXX: process.binding('util').is[...] typechecks
937+
938+
Type: Documentation-only (supports [`--pending-deprecation`][])
939+
940+
Using `process.binding()` in general should be avoided. The type checking
941+
methods in particular can be replaced by using [`util.types`][].
942+
935943
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
936944
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
937945
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
@@ -1000,6 +1008,7 @@ could lead to hard to find errors and crashes.
10001008
[`util.log()`]: util.html#util_util_log_string
10011009
[`util.print()`]: util.html#util_util_print_strings
10021010
[`util.puts()`]: util.html#util_util_puts_strings
1011+
[`util.types`]: util.html#util_util_types
10031012
[`util`]: util.html
10041013
[`worker.exitedAfterDisconnect`]: cluster.html#cluster_worker_exitedafterdisconnect
10051014
[alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding

0 commit comments

Comments
 (0)