mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
66 lines
1.3 KiB
TypeScript
66 lines
1.3 KiB
TypeScript
//// [tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionLikeClasses.ts] ////
|
|
|
|
//// [source.js]
|
|
/**
|
|
* @param {number} x
|
|
* @param {number} y
|
|
*/
|
|
export function Point(x, y) {
|
|
if (!(this instanceof Point)) {
|
|
return new Point(x, y);
|
|
}
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
//// [referencer.js]
|
|
import {Point} from "./source";
|
|
|
|
/**
|
|
* @param {Point} p
|
|
*/
|
|
export function magnitude(p) {
|
|
return Math.sqrt(p.x ** 2 + p.y ** 2);
|
|
}
|
|
|
|
|
|
//// [source.js]
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Point = Point;
|
|
/**
|
|
* @param {number} x
|
|
* @param {number} y
|
|
*/
|
|
function Point(x, y) {
|
|
if (!(this instanceof Point)) {
|
|
return new Point(x, y);
|
|
}
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
//// [referencer.js]
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.magnitude = magnitude;
|
|
const source_1 = require("./source");
|
|
/**
|
|
* @param {Point} p
|
|
*/
|
|
function magnitude(p) {
|
|
return Math.sqrt(Math.pow(p.x, 2) + Math.pow(p.y, 2));
|
|
}
|
|
|
|
|
|
//// [source.d.ts]
|
|
/**
|
|
* @param {number} x
|
|
* @param {number} y
|
|
*/
|
|
export declare function Point(x: number, y: number): any;
|
|
//// [referencer.d.ts]
|
|
/**
|
|
* @param {Point} p
|
|
*/
|
|
export declare function magnitude(p: Point): number;
|