小编Yeg*_*mba的帖子

删除和删除有什么区别?

例如,我有一个TypeORM实体Profile

@Entity()
class Profile {

    @PrimaryGeneratedColumn()
    id: number;

    @Column()
    gender: string;

    @Column()
    photo: string;

    @OneToOne(type => User, { cascade: true })
    @JoinColumn()
    user: User;
}
Run Code Online (Sandbox Code Playgroud)

我不确定应该使用哪一个删除用户个人资料?

Profile.remove(profile)
Profile.delete(profile)
Run Code Online (Sandbox Code Playgroud)

TypeORM中removedelete方法之间有什么区别?

typescript typeorm

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

输入'字符串| AddressInfo' 没有属性 'port' 也没有字符串索引签名

{ port }我得到错误:键入 'string | AddressInfo' 没有属性 'port',也没有字符串索引签名。

如何解决?

代码:

import * as express from 'express'
const app = express()

app.listen({ port: process.env.PORT })

const { port } = app.address()
Run Code Online (Sandbox Code Playgroud)

我的 tsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
    "sourceMap": true,
    "outDir": "./dist",
    "moduleResolution": "node",

    "composite": true,
    "removeComments": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "allowSyntheticDefaultImports": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "baseUrl": ".." …
Run Code Online (Sandbox Code Playgroud)

typescript

5
推荐指数
1
解决办法
1884
查看次数

TypeScript 节点服务器设置。如何删除 dist 文件夹中的所有 *.d.ts 文件?

当我部署我的服务器时出现错误

server_1    | (node:9) UnhandledPromiseRejectionWarning: /usr/app/packages/server/dist/modules/listing/create/resolvers.d.ts:1
server_1    | (function (exports, require, module, __filename, __dirname) { import { MutationResolvers } from '../../../types';
server_1    |                                                                      ^
server_1    | 
server_1    | SyntaxError: Unexpected token {
Run Code Online (Sandbox Code Playgroud)

我的解决方案(它有效)是删除*.d.ts任何地方的所有文件。这是我的packages.json脚本及其质量

    "build": "tsc -b && copyfiles -u 1 src/**/*.graphql dist/ && rimraf ./dist/*.d.ts && rimraf ./dist/**/*.d.ts && rimraf ./dist/**/**/*.d.ts && rimraf ./dist/**/**/**/*.d.ts"
Run Code Online (Sandbox Code Playgroud)

如何*.d.tsdist没有文件夹嵌套的情况下删除文件夹中的所有文件?

rm node.js typescript package.json

2
推荐指数
1
解决办法
1970
查看次数

返回坚固度为 0.5.0 的字符串。数据位置必须是函数中返回参数的“内存”

如何在 0.5.0 solidity 编译器版本中返回字符串?

contract Test {
    string public text = 'show me';
    function  test() public view returns (string) {
        return text;
    }
}
Run Code Online (Sandbox Code Playgroud)

我收到错误消息:

TypeError: Data location must be "memory" for return parameter in function, but none was given.
Run Code Online (Sandbox Code Playgroud)

ethereum solidity smartcontracts

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