我试图在一个简单的Vue应用程序中使用vue-tabulator组件:,该应用程序恰好是用TypeScript编写的。
main.ts
import Vue from 'vue'
import VueTabulator from 'vue-tabulator'
import App from './App.vue'
Vue.config.productionTip = false
Vue.use(VueTabulator)
new Vue({
render: h => h(App)
}).$mount('#app'
我们为material-ui@next创建了类型,并希望将它们与库一起发送,这是我们在上一个测试版中所做的。
下面是指向的链接。
但是,这些类型在当前的形式中是不可用的。在开发中,它们在本地使用并且工作良好,但是当将文件与库一起传送时,TypeScript似乎使用了不同的发现策略。
引用子文件夹(例如declare 'material-ui/Button/Button')的所有类型都不会是TypeScript。当导入组件时,会出现一个错误:
[ts]
Could not find a declaration file for module 'material-ui/Bu
我的文件src/auth/ManagementAPI.ts使用Auth0。我需要使用我自己的声明文件并创建了src/@types/auth0.d.ts。
但是,当我运行ts-node时,会得到以下错误:
TSError: ⨯ Unable to compile TypeScript:
auth/ManagementAPI.ts(1,69): error TS7016: Could not find a declaration file for module 'auth0'. '/Users/danrumney/WebstormProjects/ohana/node_mo
我得到的文件节点_模块/@type/webrtc/index.d.ts不是一个具有以下代码的模块:
import * as webrtc from "webrtc";
const peerConnection1 = new RTCPeerConnection();
我已经使用npm i @types/webrtc --save-dev安装了这些类型。在RTCPeerConnection上悬停在Visual中的const peerConnection1 = new RTCPeerConnection();中显示类型注释,因此代码编辑器至少可以看到这些类型。运行tsc (或使用ts
我有一段时间一直试图在我的NextJS项目中使用打字本.我认为从打字本开始是最困难的,但不是:它的安装更加复杂。
我遵循了上所说的(创建一个新项目)。
以下是我所做的事情:
npx create-next-app --ts
cd test-nextts
npm run dev
这是我在npm run dev上遇到的错误
> test-nextts@0.1.0 dev
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
It looks like you're tryin
我有两个NPM模块,我们称它们为A和B。
两者都是用TypeScript编写的。这两个模块都编译成类似CommonJS节点的模块。
模块B依赖于模块A,所以我安装了npm install --save A。它已正确安装到node_modules/A文件夹中。
然后,在我的新模块B中,我想使用来自模块A的类Class。所以我写:
// import Class from 'A/lib/Class'; <- This import statement must be suggested by PhpStorm
export default class NewClass ex
有一个第三方all-javascript npm 包,我们称它为@foo,里面有一个叫做bar的模块。我想在我的typescript .tsx文件中使用react组件@foo/bar/X。当我尝试import X from '@foo/bar/X'时,我立即遇到了“找不到模块”。我如何使用 typescript来解决这个问题来解析模块X,并让webpack运行而不出现错误?
我正在TypeScript中开发两个项目。首先,一个名为my-node-module的本机节点模块。它是由我的主机项目host-project导入的。
package.json of host-project
"my-node-module": "git+ssh://git@github.com:foo/my-node-module"
my-node-module是用TypeScript编写的。我想在我的主机项目中导入它。
问题1
package.json of my-node-module中的主要条目是js/index.js。如果我在npm run