You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempted to run the small example code in the README file but got an error.
Machine Details
Node version 17.9.1
OS: Mac OS Ventura
Steps to reproduce
Create a new project (npm init then insteall @clock/core, copy and paste the first code block in this bug report and attempt to run it
node index.mjs
on the following file called index.mjs
import{TextPrompt,isCancel}from"@clack/core";constp=newTextPrompt({render(){return`What's your name?\n${this.valueWithCursor}`;},});constname=awaitp.prompt();if(isCancel(name)){return;}
fails with the following error:
~/Downloads/test-scripts/clack-cli-test node index.mjs
file:///Users/cfajardo/Downloads/test-scripts/clack-cli-test/index.mjs:11
return;
^^^^^^
SyntaxError: Illegal return statement
at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:117:18)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:361:14)
at async link (node:internal/modules/esm/module_job:70:21)
It seems the problem is with the isCancel because this works fine:
// index.mjs`import{TextPrompt,isCancel}from"@clack/core";constp=newTextPrompt({render(){return`What's your name?\n${this.valueWithCursor}`;},});constname=awaitp.prompt();//if (isCancel(name)) {//return;//}
The text was updated successfully, but these errors were encountered:
What is the bug?
Attempted to run the small example code in the README file but got an error.
Machine Details
Node version 17.9.1
OS: Mac OS Ventura
Steps to reproduce
Create a new project (
npm init
then insteall@clock/core
, copy and paste the first code block in this bug report and attempt to run iton the following file called
index.mjs
fails with the following error:
It seems the problem is with the
isCancel
because this works fine:The text was updated successfully, but these errors were encountered: