1
我想使用打字稿中的RegExp,但是在Visual Studio中代码被标记为错误。typescript import {RegExp}
import { RegExp } from "RegularExpressions/Regex"; // module not found.
export class BotAnswerRegex {
createRegex(){
var regex = new RegExp('hi');
// regex.isMatch is marked as an error
var result = regex.isMatch('hi, i am peter');
}
}
更新: 修正变量声明
仍然是错误'[TS]找不到模块 '打字稿,DOTNET-CommonJS的/系统/文字/ RegularExpressions'。 ' – roll
如何安装'typescript-dotnet-commonjs'模块?尝试使用'npm install typescript-dotnet-commonjs' – Diullei
LOL,我的错。作品!!! – roll