mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
147 lines
3.2 KiB
TypeScript
147 lines
3.2 KiB
TypeScript
//// [tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionsCjs.ts] ////
|
|
|
|
//// [index.js]
|
|
module.exports.a = function a() {}
|
|
|
|
module.exports.b = function b() {}
|
|
module.exports.b.cat = "cat";
|
|
|
|
module.exports.c = function c() {}
|
|
module.exports.c.Cls = class {}
|
|
|
|
/**
|
|
* @param {number} a
|
|
* @param {number} b
|
|
* @return {string}
|
|
*/
|
|
module.exports.d = function d(a, b) { return /** @type {*} */(null); }
|
|
|
|
/**
|
|
* @template T,U
|
|
* @param {T} a
|
|
* @param {U} b
|
|
* @return {T & U}
|
|
*/
|
|
module.exports.e = function e(a, b) { return /** @type {*} */(null); }
|
|
|
|
/**
|
|
* @template T
|
|
* @param {T} a
|
|
*/
|
|
module.exports.f = function f(a) {
|
|
return a;
|
|
}
|
|
module.exports.f.self = module.exports.f;
|
|
|
|
/**
|
|
* @param {{x: string}} a
|
|
* @param {{y: typeof module.exports.b}} b
|
|
*/
|
|
function g(a, b) {
|
|
return a.x && b.y();
|
|
}
|
|
|
|
module.exports.g = g;
|
|
|
|
/**
|
|
* @param {{x: string}} a
|
|
* @param {{y: typeof module.exports.b}} b
|
|
*/
|
|
function hh(a, b) {
|
|
return a.x && b.y();
|
|
}
|
|
|
|
module.exports.h = hh;
|
|
|
|
module.exports.i = function i() {}
|
|
module.exports.ii = module.exports.i;
|
|
|
|
// note that this last one doesn't make much sense in cjs, since exports aren't hoisted bindings
|
|
module.exports.jj = module.exports.j;
|
|
module.exports.j = function j() {}
|
|
|
|
|
|
//// [index.js]
|
|
"use strict";
|
|
module.exports.a = function a() { };
|
|
module.exports.b = function b() { };
|
|
module.exports.b.cat = "cat";
|
|
module.exports.c = function c() { };
|
|
module.exports.c.Cls = class {
|
|
};
|
|
/**
|
|
* @param {number} a
|
|
* @param {number} b
|
|
* @return {string}
|
|
*/
|
|
module.exports.d = function d(a, b) { return /** @type {*} */ (null); };
|
|
/**
|
|
* @template T,U
|
|
* @param {T} a
|
|
* @param {U} b
|
|
* @return {T & U}
|
|
*/
|
|
module.exports.e = function e(a, b) { return /** @type {*} */ (null); };
|
|
/**
|
|
* @template T
|
|
* @param {T} a
|
|
*/
|
|
module.exports.f = function f(a) {
|
|
return a;
|
|
};
|
|
module.exports.f.self = module.exports.f;
|
|
/**
|
|
* @param {{x: string}} a
|
|
* @param {{y: typeof module.exports.b}} b
|
|
*/
|
|
function g(a, b) {
|
|
return a.x && b.y();
|
|
}
|
|
module.exports.g = g;
|
|
/**
|
|
* @param {{x: string}} a
|
|
* @param {{y: typeof module.exports.b}} b
|
|
*/
|
|
function hh(a, b) {
|
|
return a.x && b.y();
|
|
}
|
|
module.exports.h = hh;
|
|
module.exports.i = function i() { };
|
|
module.exports.ii = module.exports.i;
|
|
// note that this last one doesn't make much sense in cjs, since exports aren't hoisted bindings
|
|
module.exports.jj = module.exports.j;
|
|
module.exports.j = function j() { };
|
|
|
|
|
|
//// [index.d.ts]
|
|
export declare var a: () => void;
|
|
export declare var b: () => void;
|
|
export declare var c: () => void;
|
|
export declare var d: (a: number, b: number) => string;
|
|
export declare var e: <T, U>(a: T, b: U) => T & U;
|
|
export declare var f: <T>(a: T) => T;
|
|
export { g };
|
|
export { hh as h };
|
|
export declare var i: () => void;
|
|
export declare var ii: () => void;
|
|
export declare var jj: () => void;
|
|
export declare var j: () => void;
|
|
/**
|
|
* @param {{x: string}} a
|
|
* @param {{y: typeof module.exports.b}} b
|
|
*/
|
|
declare function g(a: {
|
|
x: string;
|
|
}, b: {
|
|
y: () => void;
|
|
}): void | "";
|
|
/**
|
|
* @param {{x: string}} a
|
|
* @param {{y: typeof module.exports.b}} b
|
|
*/
|
|
declare function hh(a: {
|
|
x: string;
|
|
}, b: {
|
|
y: () => void;
|
|
}): void | "";
|