Skip to content

Commit

Permalink
lib: add tsconfig for code completions
Browse files Browse the repository at this point in the history
PR-URL: #38042
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
bmeck committed Apr 8, 2021
1 parent 0da7a11 commit 656fb46
Show file tree
Hide file tree
Showing 6 changed files with 1,062 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ const legacyWrapperList = new SafeSet([
}

// Set up internalBinding() in the closure.
/**
* @type {InternalBinding}
*/
let internalBinding;
{
const bindingObj = ObjectCreate(null);
Expand Down
6 changes: 5 additions & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@ function makeNodeErrorWithCode(Base, key) {
};
}

// This function removes unnecessary frames from Node.js core errors.
/**
* This function removes unnecessary frames from Node.js core errors.
* @template {(...args: any[]) => any} T
* @type {(fn: T) => T}
*/
function hideStackFrames(fn) {
// We rename the functions that will be hidden to cut off the stacktrace
// at the outermost one
Expand Down
3 changes: 3 additions & 0 deletions lib/internal/per_context/primordials.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ const copyProps = (src, dest) => {
});
};

/**
* @type {typeof primordials.makeSafe}
*/
const makeSafe = (unsafe, safe) => {
if (SymbolIterator in unsafe.prototype) {
const dummy = new unsafe();
Expand Down
84 changes: 84 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"include": ["lib","doc"],
"exclude": ["src","tools","out"],
"files": [
"./typings/internalBinding.d.ts",
"./typings/primordials.d.ts"
],
"compilerOptions": {
"allowJs": true,
"checkJs": false,
"noEmit": true,
"lib": ["ESNext"],
"target": "ESNext",
"module": "CommonJS",
"baseUrl": ".",
"paths": {
"_http_agent": ["./lib/_http_agent.js"],
"_http_client": ["./lib/_http_client.js"],
"_http_common": ["./lib/_http_common.js"],
"_http_incoming": ["./lib/_http_incoming.js"],
"_http_outgoing": ["./lib/_http_outgoing.js"],
"_http_server": ["./lib/_http_server.js"],
"_stream_duplex": ["./lib/_stream_duplex.js"],
"_stream_passthrough": ["./lib/_stream_passthrough.js"],
"_stream_readable": ["./lib/_stream_readable.js"],
"_stream_transform": ["./lib/_stream_transform.js"],
"_stream_wrap": ["./lib/_stream_wrap.js"],
"_stream_writable": ["./lib/_stream_writable.js"],
"_tls_common": ["./lib/_tls_common.js"],
"_tls_wrap": ["./lib/_tls_wrap.js"],
"assert": ["./lib/assert.js"],
"assert/strict": ["./lib/assert/strict.js"],
"async_hooks": ["./lib/async_hooks.js"],
"buffer": ["./lib/buffer.js"],
"child_process": ["./lib/child_process.js"],
"cluster": ["./lib/cluster.js"],
"console": ["./lib/console.js"],
"constants": ["./lib/constants.js"],
"crypto": ["./lib/crypto.js"],
"dgram": ["./lib/dgram.js"],
"diagnostics_channel": ["./lib/diagnostics_channel.js"],
"dns": ["./lib/dns.js"],
"dns/promises": ["./lib/dns/promises.js"],
"domain": ["./lib/domain.js"],
"events": ["./lib/events.js"],
"fs": ["./lib/fs.js"],
"fs/promises": ["./lib/fs/promises.js"],
"http": ["./lib/http.js"],
"http2": ["./lib/http2.js"],
"https": ["./lib/https.js"],
"inspector": ["./lib/inspector.js"],
"internal/*": ["./lib/internal/*"],
"module": ["./lib/module.js"],
"net": ["./lib/net.js"],
"os": ["./lib/os.js"],
"path": ["./lib/path.js"],
"path/posix": ["./lib/path/posix.js"],
"path/win32": ["./lib/path/win32.js"],
"perf_hooks": ["./lib/perf_hooks.js"],
"process": ["./lib/process.js"],
"punycode": ["./lib/punycode.js"],
"querystring": ["./lib/querystring.js"],
"readline": ["./lib/readline.js"],
"repl": ["./lib/repl.js"],
"stream": ["./lib/stream.js"],
"stream/promises": ["./lib/stream/promises.js"],
"string_decoder": ["./lib/string_decoder.js"],
"sys": ["./lib/sys.js"],
"timers": ["./lib/timers.js"],
"timers/promises": ["./lib/timers/promises.js"],
"tls": ["./lib/tls.js"],
"trace_events": ["./lib/trace_events.js"],
"tty": ["./lib/tty.js"],
"url": ["./lib/url.js"],
"util": ["./lib/util.js"],
"util/types": ["./lib/util/types.js"],
"v8": ["./lib/v8.js"],
"vm": ["./lib/vm.js"],
"wasi": ["./lib/wasi.js"],
"worker_threads": ["./lib/worker_threads.js"],
"zlib": ["./lib/zlib.js"],
}
}
}
Loading

0 comments on commit 656fb46

Please sign in to comment.