简体   繁体   English

如何安装 type-graphql?

[英]How to install type-graphql?

I want to import this in my TypeScript project:我想在我的 TypeScript 项目中导入这个:

import { ID } from "type-graphql";

but I am unable to install type-graphql.但我无法安装 type-graphql。 I tried this but it gave me a 404 error saying that this is not found in the nam registry我试过了,但它给了我一个 404 错误,说这在 nam 注册表中找不到

npm install @types/type-graphql

package with prefix @types/ is only type definition for typescript带有前缀@types/的 package 只是 typescript 的类型定义

type-graphql is built on typescript, so you dont need install @types/type-graphql just install type-graphql type-graphql 是基于 typescript 构建的,所以你不需要安装@types/type-graphql只需安装type-graphql

please follow the documentation https://typegraphql.com/docs/installation.html#packages-installation请按照文档https://typegraphql.com/docs/installation.html#packages-installation

Basically you can search the www.npmjs.com基本上你可以搜索www.npmjs.com

If there is no such option, then there is no so-named package been published.如果没有这样的选项,则没有发布所谓的 package。 And that's the reason for 404这就是404的原因


And since from their description, they have Typescript supported inside.而且根据他们的描述,他们内部支持 Typescript。

You may not need an extract @Types/.. for this.您可能不需要提取@Types/..为此。

Create GraphQL schema and resolvers with TypeScript, using classes and decorators!使用类和装饰器,使用 TypeScript 创建 GraphQL 模式和解析器!


在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM