TypeScript/tests/cases/compiler/jsEnumTagOnObjectFrozen.ts
Wesley Wigham d9f0212324
Resolve SymbolFlags.Type only at first in jsdoc getTypeFromTypeReference (#32947)
* 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
2019-08-19 11:31:47 -07:00

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,
};
});