首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >类型记录生成无效的三重斜杠指令

类型记录生成无效的三重斜杠指令
EN

Stack Overflow用户
提问于 2019-12-11 20:38:06
回答 1查看 284关注 0票数 0

使用类型记录3.7.3,当我构建我的项目时,它会在我的主index.d.ts中生成无效的三重斜杠指令。

这是我的index.d.ts的一个摘录:

代码语言:javascript
复制
/// <reference path="types/augmentations.d.ts" />
/// <reference types="node" />
/// <reference types="fastify" />
/// <reference types="mongoose" />
/// <reference types="@keplr/backend-types/lib/mongo" />
/// <reference types="node/http" />
/// <reference types="@keplr/backend-types/lib/fastify" />
/// <reference types="fastify-cookie" />
/// <reference types="fastify-multipart" />
import * as email from './helpers/email';
import * as password from './helpers/password';
import * as token from './helpers/token';
export declare const models: {
    ...
};
export declare const plugins: {
    MainPlugin: (instance: import("fastify").FastifyInstance<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse>, options: unknown, callback: (err?: import("fastify").FastifyError | undefined) => void) => void;
    RouteLessPlugin: (instance: import("fastify").FastifyInstance<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse>, options: unknown, callback: (err?: import("fastify").FastifyError | undefined) => void) => void;
};

/// <reference types="node/http" />无效并生成错误。

如何防止TS为node/http生成三重斜杠指令?

我试了一下TS 3.6,还是一样的。

这是我的tsconfig

代码语言:javascript
复制
{
  "compilerOptions": {
    "target": "es2020",
    "lib": ["es2020", "esnext.asynciterable"],
    "module": "commonjs",
    "declaration": true,
    "outDir": "./lib",
    "rootDir": "./src",
    "strict": true,
    "incremental": true,
    "tsBuildInfoFile": "./.tsbuildinfo",
    "noUnusedLocals": true,
    "esModuleInterop": false
  },
  "include": ["./src/**/*.ts"],
  "exclude": ["**/__tests__"]
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-12-21 19:24:38

如果有人有同样的问题。

这是由于内部库中的节点http模块增加而造成的问题。

代码语言:javascript
复制
declare module 'http' { 
...
}

放弃这种增强解决了问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59293719

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档