d9f0212324
* Fix lookup of exported eunm type alias in local scope in JS * Fix by adjusting type lookup fallback behavior to not include SymbolFlags.Value in its initial lookup instead
46 lines
724 B
TypeScript
46 lines
724 B
TypeScript
// @noEmit: true
|
|
// @checkJs: true
|
|
// @allowJs: true
|
|
// @filename: index.js
|
|
/** @enum {string} */
|
|
const Thing = Object.freeze({
|
|
a: "thing",
|
|
b: "chill"
|
|
});
|
|
|
|
exports.Thing = Thing;
|
|
|
|
/**
|
|
* @param {Thing} x
|
|
*/
|
|
function useThing(x) {}
|
|
|
|
exports.useThing = useThing;
|
|
|
|
/**
|
|
* @param {(x: Thing) => void} x
|
|
*/
|
|
function cbThing(x) {}
|
|
|
|
exports.cbThing = cbThing;
|
|
|
|
// @filename: usage.js
|
|
|
|
const { Thing, useThing, cbThing } = require("./index");
|
|
|
|
useThing(Thing.a);
|
|
|
|
/**
|
|
* @typedef {Object} LogEntry
|
|
* @property {string} type
|
|
* @property {number} time
|
|
*/
|
|
|
|
cbThing(type => {
|
|
/** @type {LogEntry} */
|
|
const logEntry = {
|
|
time: Date.now(),
|
|
type,
|
|
};
|
|
});
|