mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
30 lines
434 B
TypeScript
30 lines
434 B
TypeScript
// @allowJs: true
|
|
// @checkJs: true
|
|
// @noEmit: true
|
|
// @Filename: templateTagOnConstructorFunctions.js
|
|
|
|
/**
|
|
* @template U
|
|
* @typedef {(u: U) => U} Id
|
|
*/
|
|
/**
|
|
* @param {T} t
|
|
* @template T
|
|
*/
|
|
function Zet(t) {
|
|
/** @type {T} */
|
|
this.u
|
|
this.t = t
|
|
}
|
|
/**
|
|
* @param {T} v
|
|
* @param {Id<T>} id
|
|
*/
|
|
Zet.prototype.add = function(v, id) {
|
|
this.u = v || this.t
|
|
return id(this.u)
|
|
}
|
|
var z = new Zet(1)
|
|
z.t = 2
|
|
z.u = false
|