- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在尝试使用我创建的 nodejs 包,有人可以指出我做错了什么吗。
包结构如下:
node_modules
|__my_commons
| |__dist
| |__src
| | |__helpers.d.ts
| | |__helpers.js
| | |__index.d.ts
| | |__index.js
| |__node_modules <=This got recursively installed
| |__.npmignore
| |__package.json
src
|_app/app.component.ts <= Here I am using it
my_commons/package.json
{
"_args": [
[
{
"raw": "my_commons@bitbucket:ishan_dutta/my_commons",
"scope": null,
"escapedName": "my_commons",
"name": "my_commons",
"rawSpec": "bitbucket:ishan_dutta/my_commons",
"spec": "bitbucket:ishan_dutta/my_commons",
"type": "hosted",
"hosted": {
"type": "bitbucket",
"ssh": "git@bitbucket.org:ishan_dutta/my_commons.git",
"sshUrl": "git+ssh://git@bitbucket.org/ishan_dutta/my_commons.git",
"httpsUrl": "git+https://bitbucket.org/ishan_dutta/my_commons.git",
"shortcut": "bitbucket:ishan_dutta/my_commons",
"directUrl": "https://bitbucket.org/ishan_dutta/my_commons/raw/master/package.json"
}
},
"/Users/ishandutta2007/Documents/Projects/my_proj"
]
],
"_from": "bitbucket:ishan_dutta/my_commons",
"_id": "my_commons@1.0.0",
"_inCache": true,
"_location": "/my_commons",
"_phantomChildren": {},
"_requested": {
"raw": "my_commons@bitbucket:ishan_dutta/my_commons",
"scope": null,
"escapedName": "my_commons",
"name": "my_commons",
"rawSpec": "bitbucket:ishan_dutta/my_commons",
"spec": "bitbucket:ishan_dutta/my_commons",
"type": "hosted",
"hosted": {
"type": "bitbucket",
"ssh": "git@bitbucket.org:ishan_dutta/my_commons.git",
"sshUrl": "git+ssh://git@bitbucket.org/ishan_dutta/my_commons.git",
"httpsUrl": "git+https://bitbucket.org/ishan_dutta/my_commons.git",
"shortcut": "bitbucket:ishan_dutta/my_commons",
"directUrl": "https://bitbucket.org/ishan_dutta/my_commons/raw/master/package.json"
}
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "git+https://bitbucket.org/ishan_dutta/my_commons.git#6fef24d35f8b2b1f6f3d362cccaf92ca4fa62a93",
"_shasum": "ad2546c6aadd832baf97d5334b60cc355b4e6647",
"_shrinkwrap": null,
"_spec": "my_commons@bitbucket.org/ishan_dutta/my_commons",
"_where": "/Users/ishandutta2007/Documents/Projects/my_proj",
"author": "",
"dependencies": {
"@types/node": "^7.0.8",
"aws-sdk": "2.28.0",
"firebase": "^3.6.7",
"gulp": "^3.9.1",
"gulp-typescript": "^3.1.4",
"requirejs": "^2.3.3",
"typescript": "^2.0.10"
},
"description": "all common code to be shared across multiple projects",
"devDependencies": {},
"engines": {
"node": "7.6.0"
},
"gitHead": "6fef24d35f8b2b1f6f3d362cccaf92ca4fa62a93",
"license": "ISC",
"main": "dist/src/index.js",
"name": "mystartup_commons",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.0.0"
}
helpers.d.ts:
export declare namespace Helpers {
const tags: string[];
function roundMinutes(date: any): any;
function convertDateToUTC(date: any): Date;
}
helpers.js:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var http = require('http');
var https = require('https');
var fs = require('fs');
var AWS = require('aws-sdk');
var myBucket = 'videoreactions';
var Helpers;
(function (Helpers) {
Helpers.tags = [
'national',
'business',
'sports',
'world',
'politics',
'technology',
'startup',
'entertainment',
'miscellaneous',
'science',
'automobile'
];
function roundMinutes(date) {
date.setHours(date.getHours() + Math.round(date.getMinutes() / 60));
date.setMinutes(0);
return date;
}
Helpers.roundMinutes = roundMinutes;
function convertDateToUTC(date) {
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
}
Helpers.convertDateToUTC = convertDateToUTC;
})(Helpers = exports.Helpers || (exports.Helpers = {}));
index.d.ts:
export * from "./helpers";
index.js:
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./helpers"));
应用程序组件.ts:
import {Helpers} from 'my_commons';
错误:
[ts] Could not find a declaration file for module 'my_commons'. '/Users/ishandutta2007/Documents/Projects/my_proj/node_modules/my_commons/dist/src/index.js' implicitly has an 'any' type.
最佳答案
您没有在您的 package.json 中指出您的 my_commons
包中有类型:
// my_commons package.json
{
"typings": "dist/src/index.d.ts"
}
关于javascript - 找不到模块的声明文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42940920/
例如,我有一个父类Author: class Author { String name static hasMany = [ fiction: Book,
代码如下: dojo.query(subNav.navClass).forEach(function(node, index, arr){ if(dojo.style(node, 'd
我有一个带有 Id 和姓名的学生表和一个带有 Id 和 friend Id 的 Friends 表。我想加入这两个表并找到学生的 friend 。 例如,Ashley 的 friend 是 Saman
我通过互联网浏览,但仍未找到问题的答案。应该很容易: class Parent { String name Child child } 当我有一个 child 对象时,如何获得它的 paren
我正在尝试创建一个以 Firebase 作为我的后端的社交应用。现在我正面临如何(在哪里?)找到 friend 功能的问题。 我有每个用户的邮件地址。 我可以访问用户的电话也预订。 在传统的后端中,我
我主要想澄清以下几点: 1。有人告诉我,在 iOS 5 及以下版本中,如果您使用 Game Center 设置多人游戏,则“查找 Facebook 好友”(如与好友争夺战)的功能不是内置的,因此您需要
关于redis docker镜像ENTRYPOINT脚本 docker-entrypoint.sh : #!/bin/sh set -e # first arg is `-f` or `--some-
我是一名优秀的程序员,十分优秀!