小编Val*_*era的帖子

是否可以将 typescript 对象限制为仅包含其类定义的属性?

这是我的代码

async getAll(): Promise<GetAllUserData[]> {
    return await dbQuery(); // dbQuery returns User[]
}

class User {
    id: number;
    name: string;
}

class GetAllUserData{
    id: number;
}
Run Code Online (Sandbox Code Playgroud)

getAll函数返回User[],并且数组的每个元素都有name属性,即使它的返回类型是GetAllUserData[]

我想知道是否可以out of the box在打字稿中将对象限制为仅由其类型指定的属性。

typescript

30
推荐指数
5
解决办法
2万
查看次数

nginx + vueJS + 静态登陆页面

我需要在 上打开登陆页面,在 上打开/vueJS 应用程序/app。这是我当前的 nginx 设置:

server {
    listen 80;

    location /app {
            alias /var/www/app/dist/;
            try_files $uri $uri/ /index.html;
    }

    location / {
            alias /var/www/landing/dist/;
            try_files $uri $uri/ /index.html;
    }
}
Run Code Online (Sandbox Code Playgroud)

/当我转到 时,它会打开登陆和 vueJS 应用程序/app,但是,如果我打开/app/login它会转到登陆页面而不是 vue 应用程序。我究竟做错了什么 ?

nginx

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

找不到Python可执行文件

Error: Can't find Python executable "D:\Python", you can set the PYTHON env variable. at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)

我安装了python(2.7.14)D:\Python,并设置了环境变量在此输入图像描述

我也试过了SET PYTHON=D:\Python.

python 命令行命令工作正常.

python.exe 在... D:\Python 在此输入图像描述

我究竟做错了什么 ?

python node.js

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

标签 统计

nginx ×1

node.js ×1

python ×1

typescript ×1