From fa9f16c5ee95928cbd019107f98d89b5fc9e6c51 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 10 Jan 2019 08:33:55 -0600 Subject: [PATCH 1/2] Update jsdoc.md Add a section demonstrating how to import types from typescript libraries. --- jsdoc.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/jsdoc.md b/jsdoc.md index dae7a7a0c..9fed13b50 100644 --- a/jsdoc.md +++ b/jsdoc.md @@ -2,7 +2,7 @@ title: Jsdoc category: JavaScript layout: 2017/sheet -updated: 2017-10-29 +updated: 2019-01-10 weight: -1 --- @@ -79,6 +79,18 @@ function play (song) { See: +### Importing Types +```js +/** + * @typedef {import('Foo').default} Bar + */ + +/** + * @param {Bar} x + */ +function test(x) { } +``` + ### Other keywords ```js From 94db676cfeabe3513d8f5d903b72a72f38797ee7 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sun, 24 Mar 2019 07:34:48 +0800 Subject: [PATCH 2/2] jsdoc: Note that importing is TypeScript-specific --- jsdoc.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jsdoc.md b/jsdoc.md index 9fed13b50..027076aa7 100644 --- a/jsdoc.md +++ b/jsdoc.md @@ -79,18 +79,22 @@ function play (song) { See: -### Importing Types +### Importing types + ```js /** - * @typedef {import('Foo').default} Bar + * @typedef {import('./Foo').default} Bar */ - + /** * @param {Bar} x */ + function test(x) { } ``` +This syntax is [TypeScript-specific](https://github.com/Microsoft/TypeScript/wiki/JsDoc-support-in-JavaScript#import-types). + ### Other keywords ```js