Skip to content

Fix indefinite wait and simplify per De Morgan's law #2156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,16 @@ export function createRepl(options: CreateReplOptions = {}) {
// Declare node builtins.
// Skip the same builtins as `addBuiltinLibsToObject`:
// those starting with _
// those containing /
// those containing / or :
// those that already exist as globals
// Intentionally suppress type errors in case @types/node does not declare any of them, and because
// `declare import` is technically invalid syntax.
// Avoid this when in transpileOnly, because third-party transpilers may not handle `declare import`.
if (!service?.transpileOnly) {
state.input += `// @ts-ignore\n${builtinModules
.filter(
(name) => !name.startsWith('_') && !name.includes('/') && !['console', 'module', 'process'].includes(name)
(name) => !(name.startsWith('_') || name.includes('/') || name.includes(':')
|| ['console', 'module', 'process'].includes(name))
)
.map((name) => `declare import ${name} = require('${name}')`)
.join(';')}\n`;
Expand Down