- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我想使用 vim
的 syntastic
插件,在我使用 tsc
编写 typescript 文件时为我提供实时错误检查。我已经在 vim
中激活了 tsc
。关于如何让 tsc
使用最近父级的 tsconfig.json
文件作为配置的任何建议?我发现 tsc
默认情况下不这样做,这使得 syntastic
配置变得困难。谢谢!
编辑:我认为它没有使用 tsconfig.json
的原因是因为像模块解析方法这样的选项似乎不起作用(“require”未定义),而且它也不是t 捕获我在 tsconfig.json
中的 files
属性中定义的定义文件。
我尝试解决这个问题失败了:
let g:syntastic_typescript_checks=['tsc', 'tslint']
" typescript: find tsconfig.json
function! FindTypescriptRoot()
return fnamemodify(findfile('tsconfig.json', './;'), ':h')
endfunction
let g:syntastic_typescript_tsc_args=['-p', FindTypescriptRoot()]
这导致 Syntastic 向我吐出这个错误:
app.ts|| TS5042: Option 'project' cannot be mixed with source files on a command line.
这可能是因为它正在运行类似 tsc -p/path/to/project/app.ts
的命令,这是对该标志的非法使用...但我不明白为什么我在 tsconfig.json
中的设置被 syntastic
忽略了:(
最佳答案
添加 let g:syntastic_typescript_tsc_fname = ''
到 .vimrc
。
作为romainl在 his answer 中提到, "Using tsconfig.json" Typescript wiki 的部分说明:
By invoking tsc with no input files, in which case the compiler searches for the
tsconfig.json
file starting in the current directory and continuing up the parent directory chain.
您可以在 Vim 中执行此操作使用 Syntastic通过将以下内容添加到您的 .vimrc
或 .vimrc.after
如果您使用 Janus ,如 LCD 047 中所见对您的 Syntastic issue #1628 的回答:
let g:syntastic_typescript_tsc_fname = ''
关于vim - 使用 tsconfig.json for tsc with syntastic in vim,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34102184/
我有两个项目:app 和 lib。 app 依赖于 lib。 app 是一个严格的 Typescript 项目,lib 不工作 严格。 我使用 Typescript 项目引用将它们连接在一起: ./t
当我尝试使用VITE安装Reaction with TypeScrip时,我在tsfig.json中遇到错误。这就是我面临错误的地方。。同样的代码库在我同事的PC上运行得很好,但我面临着这个问题。。为
typescript 版本: 1.8.30.0 问题 我们有许多网络项目的解决方案。我们最近创建了一个使用 tsconfig.json 文件的新项目。 这影响了其他项目,相信他们有一个 tsconfi
我们有一个这样的代码库设置: -A --utils ---index.ts --index.ts --tsconfig.json -B --utils ---index.ts --index.ts -
我是 Angular 的新手。我使用 angular-cli 了解 Angular,我找到了文件 tsconfig.json 和 tsconfig.app.json。这两个都与 typescript
我正在使用 Vite 创建 a new React + TypeScript project . 创建项目后,根文件夹下有两个 TypeScript 配置文件:tsconfig.json和 tscon
学习 TypeScript 和 Visual Studio 就是提示: Build: Failed to parse file 'C:/.../tsconfig.json/tsconfig.json'
请引用此 git 存储库:https://github.com/AngularClass/angular-starter Angular4 Webpack Starter 带有 2 个文件: tsco
**摘要:**原来在我们创建tsconfig.json文件的时候,VSCode会自动检测当前项目当中是否有TS文件;如果没有的话,就会报这个错提示我们去创建一个文件,再去使用。 本文分享自华为云社区《
我正在尝试将我的 Typescript 项目配置为具有以下目录结构: src/ ├── client/ │ └── tsconfig.json │ ├── server/ │ └── tsco
我想为每个脚本文件夹编译一个新的js文件夹。这可以用 tsconfig.json 实现吗? 目录 folder1 scripts index.ts folder2 scripts
我正在尝试了解 typescript 模块编译器选项。 我浏览了 typescript 文档 - docs 它说模块选项是 Specify module code generation . 这意味着什
在探索 tsconfig.json 文件时,我坚持理解 tsconfig.json 中增量的确切含义 最佳答案 通过将先前编译的信息读/写到磁盘上的文件来启用增量编译。该文件由 --tsBuildIn
不知道为什么,但在我刚刚创建的 tsconfig.js 文件中出现解析错误。来源:https://www.typescriptlang.org/docs/handbook/react-&-webpac
根据 TypeScript's docs ,在 types 中设置一个值将覆盖默认行为并且只查找我指定的类型: By default all visible ”@types” packages are
我现在很抓狂,为什么我的 typescript 编译 (tsc) 总是尝试编译 node_modules 文件,即使我已经指定排除这个文件夹。 [tl;dr;:这是因为我有导入但我不知道如何从编译中排
根据我的理解,我们可以分配值“commonjs”或“AMD”到 tsconfig.json 中的“模块”属性。 我们可以分配除这两个之外的任何其他值吗? .... .... { "compile
有人可以解释为什么这不会引发错误吗? interface A { id?: number; } const a:A = { id: 5 }; const testA: boolean
我正在尝试在我的 Angular 5 应用程序中使用仅在 JavaScript 语言中可用的 .js 文件,因此我在 TypeScript 中找不到替代方案。 问题是我添加了 "allowJs": t
我正在使用 create-react-app 并且我还有一些 ts 和 tsx 文件。在我的 tsconfig 文件(见下文)中,我将 noEmit 设置为 false,因为需要发出 js 文件。但是
我是一名优秀的程序员,十分优秀!