Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 chalk 2.0 中,可以使用标记字符串:
const chalk = require('chalk'); console.log(chalk`{bold some} text`);
如何修改 chalk 的类型定义以使 TypeScript 满意?目前,我得到:
错误 TS2349:无法调用其类型缺少调用签名的表达式。类型“typeof Chalk”没有兼容的调用签名。
With Typescript, you should be using the import syntax vs require, and the error will go away.
import chalk from 'chalk';
Note that at the time you posted your question, there was also a template issue, but it has been fixed since.