找不到@ uirouter/angularjs的内联index.d.ts [英] Can't find inline index.d.ts of @uirouter/angularjs

查看:96
本文介绍了找不到@ uirouter/angularjs的内联index.d.ts的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS Code使用Angularjs 1.6.4和ui-router的最新Typescript版本.

当前,我使用@types文件夹进行类型定义.

我已经使用了一段时间的Typescript定义文件存在此问题-即moment.js,现在当我尝试将"angular-ui-router"升级到新的嵌套@ uirouter/angularjs时.

问题似乎是,打字稿不知道要查看外部库的package.json文件中的"Typings"字段作为其定义文件,即使在明显存在此类文件的情况下,例如在moment.js中和@ uirouter/angularjs.

这是我的tsconfig:

{
    "compilerOptions": {
        "baseUrl": "",
        "module": "es6",
        "noImplicitAny": true,
        "noImplicitReturns": true,
        "removeComments": true,
        "strictNullChecks": true,
        "sourceMap": true,
        "target": "es5",
        "outDir": "junk_js_files",
        "paths": {
            "services": ["app/scripts/services/*"],
            "inputDirectives": ["app/scripts/inputDirectivesModule/*"],
            "common": ["app/scripts/common/*"]
        }
    },
    "include": [
        "app/**/*.ts",
        "DefinitelyTyped/*"
    ],
    "exclude": [
        "node_modules",
        "**/*.spec.ts",
        "dist"
    ]
}

在moment.js和@ uirouter/angularjs中,您都可以清楚地看到package.json文件中有一个字段,说明键入(index.d.ts)文件的位置,为什么打字稿会忽略它?

由于这个烦人的错误,我无法升级到最新的uirouter,这使我无法使用最新的定义文件.

如何教"打字稿以查找打字字段并使用第三方图书馆提供的index.d.ts?

谢谢, 阿维.

解决方案

发现此问题并且也有此问题的人,在这里: https://github.com/Microsoft/TypeScript/issues/17958

I'm using the latest Typescript version with Angularjs 1.6.4 and ui-router, using VS Code.

Currently I'm using the @types folder for type definitions.

There's this problem with Typescript definitions file I've been having for quite some time - namely with moment.js and now when I tried upgrading "angular-ui-router" to the new nested @uirouter/angularjs.

The problem seems to be that typescript doesn't know to look at the "Typings" field in the package.json file of external libraries for their definitions file, even in cases where there clearly is such file e.g in moment.js and @uirouter/angularjs.

This is my tsconfig:

{
    "compilerOptions": {
        "baseUrl": "",
        "module": "es6",
        "noImplicitAny": true,
        "noImplicitReturns": true,
        "removeComments": true,
        "strictNullChecks": true,
        "sourceMap": true,
        "target": "es5",
        "outDir": "junk_js_files",
        "paths": {
            "services": ["app/scripts/services/*"],
            "inputDirectives": ["app/scripts/inputDirectivesModule/*"],
            "common": ["app/scripts/common/*"]
        }
    },
    "include": [
        "app/**/*.ts",
        "DefinitelyTyped/*"
    ],
    "exclude": [
        "node_modules",
        "**/*.spec.ts",
        "dist"
    ]
}

In both moment.js and @uirouter/angularjs you can clearly see there's a field in the package.json file stating where the typings (index.d.ts) file is, why is typescript ignoring it?

I can't upgrade to the latest uirouter because of this annoying bug, which prevents me from working with the newest definitions file.

How can I "teach" typescript to look for the typings field and use the index.d.ts provided by 3rd party libraries?

Thanks, Avi.

解决方案

Whoever finds this and also has this problem, here: https://github.com/Microsoft/TypeScript/issues/17958

这篇关于找不到@ uirouter/angularjs的内联index.d.ts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆