76 lines
1.8 KiB
Plaintext
76 lines
1.8 KiB
Plaintext
=== tests/cases/conformance/jsdoc/declarations/file.js ===
|
|
/**
|
|
* @namespace myTypes
|
|
* @global
|
|
* @type {Object<string,*>}
|
|
*/
|
|
const myTypes = {
|
|
>myTypes : { [x: string]: any; }
|
|
>{ // SOME PROPS HERE} : {}
|
|
|
|
// SOME PROPS HERE
|
|
};
|
|
|
|
/** @typedef {string|RegExp|Array<string|RegExp>} myTypes.typeA */
|
|
|
|
/**
|
|
* @typedef myTypes.typeB
|
|
* @property {myTypes.typeA} prop1 - Prop 1.
|
|
* @property {string} prop2 - Prop 2.
|
|
*/
|
|
|
|
/** @typedef {myTypes.typeB|Function} myTypes.typeC */
|
|
|
|
export {myTypes};
|
|
>myTypes : { [x: string]: any; }
|
|
|
|
=== tests/cases/conformance/jsdoc/declarations/file2.js ===
|
|
import {myTypes} from './file.js';
|
|
>myTypes : any
|
|
|
|
/**
|
|
* @namespace testFnTypes
|
|
* @global
|
|
* @type {Object<string,*>}
|
|
*/
|
|
const testFnTypes = {
|
|
>testFnTypes : { [x: string]: any; }
|
|
>{ // SOME PROPS HERE} : {}
|
|
|
|
// SOME PROPS HERE
|
|
};
|
|
|
|
/** @typedef {boolean|myTypes.typeC} testFnTypes.input */
|
|
|
|
/**
|
|
* @function testFn
|
|
* @description A test function.
|
|
* @param {testFnTypes.input} input - Input.
|
|
* @returns {number|null} Result.
|
|
*/
|
|
function testFn(input) {
|
|
>testFn : (input: testFnTypes.input) => number | null
|
|
>input : import("tests/cases/conformance/jsdoc/declarations/file2").testFnTypes.input
|
|
|
|
if (typeof input === 'number') {
|
|
>typeof input === 'number' : boolean
|
|
>typeof input : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
|
>input : import("tests/cases/conformance/jsdoc/declarations/file2").testFnTypes.input
|
|
>'number' : "number"
|
|
|
|
return 2 * input;
|
|
>2 * input : number
|
|
>2 : 2
|
|
>input : never
|
|
|
|
} else {
|
|
return null;
|
|
>null : null
|
|
}
|
|
}
|
|
|
|
export {testFn, testFnTypes};
|
|
>testFn : (input: testFnTypes.input) => number
|
|
>testFnTypes : { [x: string]: any; }
|
|
|