add types.test.js

This commit is contained in:
Harvey committed 2021-12-15 15:48:18 +08:00
1 parent eb7bd68b43
commit d27f07860f
48 files changed
+257 -109

No files matched your search

@@ -0,0 +1,25 @@
---
title: How to import types
sidebar_position: 4
---
Sometimes you lose `TypeScript` syntax prompt, then you can import types manually
```js
/**
* @typedef { import("artplayer/types/artplayer") } Artplayer
*/
/**
* @type {Artplayer} - An Artplayer instance.
*/
const art1 = {};
/**
* @param {Artplayer} art2 - An Artplayer instance.
*/
function getInstance(art2) {
//
}
```
@@ -0,0 +1,25 @@
---
title: 如何导入类型
sidebar_position: 4
---
有时你会丢失 `TypeScript` 的语法提示,这时候你可以手动导入类型
```js
/**
* @typedef { import("artplayer/types/artplayer") } Artplayer
*/
/**
* @type {Artplayer} - 一个 Artplayer 实例
*/
const art1 = {};
/**
* @param {Artplayer} art2 - 一个 Artplayer 实例
*/
function getInstance(art2) {
//
}
```