每次我尝试运行我的代码时都会收到此错误.我已经尝试了一切,安装SDK,但我仍然得到同样的错误.
1>------ Build started: Project: ConsoleApplication6, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'gdi32.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Run Code Online (Sandbox Code Playgroud)
我正在使用Windows 7和Visual Studio 2012.
一切都在标题中,试图将我的 TypeScript 项目编译到 ./bin 文件夹,tsc 命令执行没有错误导致没有创建任何内容,不知道为什么。
我的 tsconfig.json
{
"compilerOptions": {
"allowJs": true,
"checkJs": false,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"lib": ["es6", "es7", "dom", "esnext"],
"module": "commonjs",
"moduleResolution": "node",
"noEmit": true,
"noImplicitAny": false,
"outDir": "bin",
"removeComments": true,
"sourceMap": true,
"target": "es2017",
"rootDirs": ["src/", "config/"],
"typeRoots": ["./node_modules/@types", "./typings"]
},
"include": ["src/**/*", "./typings"],
"exclude": ["node_modules", "bin", "**/__mocks__*", "**/*.spec.**", "test", "assets"]
}
Run Code Online (Sandbox Code Playgroud)
在我的 package.json 这是我要编译的脚本:
"scripts": {
"build-ts": "tsc",
"watch-ts": "tsc -w",
},
Run Code Online (Sandbox Code Playgroud)
我的项目结构:
rootdir
|
|-----src
| |----server.ts
| |----app.ts
|-----test …Run Code Online (Sandbox Code Playgroud) 我以前使用spyOn().and.callFake过茉莉花,它对我的测试有很大帮助,现在我使用的是Jest,我已经在文档中找到了,jest.spyOn()但是没有callFake。
我的问题:如何监视方法并使用Jest和调用Fake expect?
所以我的问题是为什么这样做并显示点:
<Field label="Password" value="•••••" type="password" />
Run Code Online (Sandbox Code Playgroud)
上面只显示了普通的六进制代码!
<Field label="Password" value={`${'•'.repeat(10)}`} type="password" />
Run Code Online (Sandbox Code Playgroud)
我的字段组件:
function renderValueByType(value: string, type: string) {
switch (type) {
case 'phone':
return phoneFormatter(value);
default:
return value;
}
}
/**
*
* @param {*} param0
*/
const Field = ({ label, value, type, className }: PropTypes) => (
<div className={className}>
<span className="Field__label">{label}</span>
<span className="Field__content">{renderValueByType(value, type)}</span>
</div>
);
Run Code Online (Sandbox Code Playgroud) 我正在尝试用字符串创建哈希映射,地图采用以下形式:
{ 'char': charOccurrence }
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
function compress(text) {
let hash = new Map();
let prev = [];
for (let i = 0; i < text.length; i++) {
let count = 0;
prev.push(text[i]);
for (let j = i+1; j < text.length; j++) {
// if (prev.indexOf(text[j]) !== -1) break;
if (text[i] === text[j]) {
count += 1;
console.log(count);
}
}
hash.set(text[i], count);
}
console.log(hash);
}
compress('aaaaahhhheaaadeee');
Run Code Online (Sandbox Code Playgroud)
问题count总是0,我不知道即使在影响for循环中的值之后这是怎么回事.这是我从这段代码中得到的:
Map { 'a' => 0, 'h' => 0, 'e' => 0, …Run Code Online (Sandbox Code Playgroud) 我正在尝试更改表中的列以将 knex 枚举修改为本机类型,以利用 Postgres 的类型系统,当我执行迁移时,我收到此错误类型"request_type" already exists,知道这里发生了什么吗?
export async function up(knex: Knex): Promise<any> {
return knex.schema.alterTable('appointments', table => {
table.enu('type', ['video', 'physical'], { useNative: true, enumName: 'request_type' }).alter();
});
}
export async function down(knex: Knex): Promise<any> {
return knex.schema
.alterTable('appointments', table => {
table.dropColumn('type');
})
.then(() => knex.raw('CREATE TYPE request_type AS ENUM("video", "physical")'))
.then(() => knex.raw('drop type request_type'));
}
Run Code Online (Sandbox Code Playgroud) javascript ×4
reactjs ×2
algorithm ×1
c++ ×1
flowtype ×1
hashmap ×1
html ×1
jestjs ×1
jsx ×1
knex.js ×1
migration ×1
node.js ×1
postgresql ×1
typescript ×1