小编Ana*_*Roy的帖子

了解Factory构造函数代码示例-Dart

我对这里提到的工厂构造函数示例有些疑问(https://www.dartlang.org/guides/language/language-tour#factory-constructors)。我知道在基本级别上只有三种类型的构造函数-默认,命名和参数化。

  1. 为什么factory在这个示例中我应该完全使用?
  2. 是正在使用的命名构造函数吗?为什么呢? 工厂构造函数示例

constructor dart

15
推荐指数
4
解决办法
7198
查看次数

使用 tsc-watch 进行 Typescript 编译 - 文件 dist/server.js 具有不受支持的扩展名

我正在尝试通过运行 npm script 将我的 typescript 服务器端文件(使用 tsc-watch)编译到输出目录。但是,我不断遇到以下错误:dist"watch": "tsc-watch --esModuleInterop ./src/server.ts --outDir ./dist --onSuccess 'node ./dist/server.js'"

error TS6054: File 'dist/server.js'' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
Run Code Online (Sandbox Code Playgroud)

tsconfig.json文件如下所示:

"compilerOptions": {
    /* Visit https://aka.ms/tsconfig.json to read more about this file */

    /* Basic Options */
   
    "target": "es5",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
    "module": "es2020",                     /* Specify module code generation: …
Run Code Online (Sandbox Code Playgroud)

typescript

6
推荐指数
1
解决办法
3224
查看次数

标签 统计

constructor ×1

dart ×1

typescript ×1