通常,在建立团队的过程中,我遇到了合并冲突,package-lock.json而我的快速解决方案一直是删除文件并使用重新生成文件npm install。我尚未认真考虑此修复程序的含义,因为它以前没有引起任何可察觉的问题。
删除文件并以npm这种方式重新创建而不是手动解决冲突是否存在问题?
我正在尝试使用一个简单的 API typescript,NodeJS但是当我运行我的代码时出现此错误
“此模块是使用 'export =' 声明的,并且只能在使用 'esModuleInterop' 标志时与默认导入一起使用。”
这是我的代码:package.json
{
"name": "API-Proyecto",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1"
},
"devDependencies": {
"@types/cors": "^2.8.6",
"@types/express": "^4.17.6",
"nodemon": "^2.0.4"
}
}
Run Code Online (Sandbox Code Playgroud)
索引.ts
import express from 'express';
import { Request, Response } from 'express';
import cors from 'cors';
const app = express();
app.use(express.urlencoded({extended: …Run Code Online (Sandbox Code Playgroud) 我目前正在将我的 RN 项目迁移到 TypeScript。我已经完成了大部分 JS 代码,现在当我运行时,tsc我收到了数百个错误,这些错误似乎都是
error TS 2717: Subsequent property declarations must have the same type. Property
prop must be of the type TYPE,
but here has type TYPE
Run Code Online (Sandbox Code Playgroud)
例如:
error TS2717: Subsequent property declarations must have the same type. Property
'view' must be of type 'SVGProps<SVGViewElement>',
but here has type 'SVGProps<SVGViewElement>'.
Run Code Online (Sandbox Code Playgroud)
这是双重混乱,因为列出的类型几乎总是相同的。
我能够运行我的应用程序,我仍然从 tslint 收到有用的消息,并且任何特定于我的代码的错误都出现在编译器错误列表的底部。
我tsconfig.json目前是:
{
"compilerOptions": {
"allowJs": true,
"target": "es2018",
"outDir": "dist",
"module": "commonjs",
"sourceMap": true,
"lib": ["esnext", "es7", "dom", "es6"], …Run Code Online (Sandbox Code Playgroud) 我只是想使用 webpack5 和 webpack-cli 启动一个新的 typescript 项目。令我惊讶的是,我收到了这些错误:
hha@melchia ~/projects/project $ npm run build
> my-webpack-project@1.0.0 build /home/hha/projects/project
> webpack
99% done plugins watchInfo[webpack-cli] Compilation finished
asset main.js 4.7 KiB [compared for emit] (name: main)
runtime modules 668 bytes 3 modules
./src/index.ts 616 bytes [built] [code generated]
ERROR in /home/hha/projects/project/node_modules/webpack/lib/javascript/JavascriptParser.js
[tsl] ERROR in /home/hha/projects/project/node_modules/webpack/lib/javascript/JavascriptParser.js(3272,7)
TS2578: Unused '@ts-expect-error' directive.
ERROR in /home/hha/projects/project/node_modules/webpack/lib/ProgressPlugin.js
[tsl] ERROR in /home/hha/projects/project/node_modules/webpack/lib/ProgressPlugin.js(392,4)
TS2578: Unused '@ts-expect-error' directive.
ERROR in /home/hha/projects/project/node_modules/webpack/lib/optimize/ConcatenatedModule.js
[tsl] ERROR in /home/hha/projects/project/node_modules/webpack/lib/optimize/ConcatenatedModule.js(1470,6)
TS2578: Unused '@ts-expect-error' directive. …Run Code Online (Sandbox Code Playgroud)