我使用此tutorial发布了一个简陋的简单打字稿模块,并通过
安装npm install --save tqt@1.0.0
当尝试在程序中使用它时,我得到了:
Module not found: Can't resolve 'tqt' in '/home/akiva/Programming/frogcast/src'
从这里:
import React from "react";
import { CA_PoliticalParty } from "tqt";
console.log(CA_PoliticalParty); // Anything that invokes this will error.
class App extends React.Component
{
constructor() {
super("");
}
render() { return ( <div> </div> )};
};
export default App;
发布的相关代码如下:
// Canadian Enumerators
export enum CA_PoliticalParty {
// Canadian Major National Political Parties
None= "None",
CPC = "CPC",
GPC = "GPC",
LPC = "LPC",
NDP = "NDP",
PPC = "PPC",
}
export {CA_PoliticalParty} from './TQt'
{
"name": "tqt",
"version": "1.0.0",
"description": "Typescript Namespaces and Enums",
"main": "index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Akiva Avraham <akiva@linux.com>",
"license": "GPL-2.0",
"repository": {
"type": "git",
"url": "git+ssh://akiva@git.launchpad.net/tqt"
},
"devDependencies": {
"typescript": "^3.6.4"
}
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"declaration": true,
"outDir": "./dist",
"lib": ["es5","es6","dom"]
},
"include": [
"src/**/*"
]
}
这里有什么明显的我想念的吗?我只以很小的方式来进行设置,没有任何变化,并且完全按照本教程的内容进行了学习。