Skip to main content

unbound_names_providing

Function unbound_names_providing 

Source
pub fn unbound_names_providing(
    program: &TsProgram,
    provided: impl Fn(&str) -> bool,
) -> Vec<String>
Expand description

unbound_names for a module whose imports provided knows: a name that provided accepts is never hidden by the global tables.

The global tables exist so that Promise or URL, which TypeScript and the Workers runtime provide, are not reported. They also hide a name the module imports that happens to share a global’s name (a user type Request or Response of bynk, or a runtime export spelled like a global): the module uses its own import, not the global, and an import list derived from the tree has to see it. Emitted code spells every real global qualified (globalThis.Promise), so a bare use of such a name is a use of the import. provided answers for the names a caller can import: the runtime’s exports when deriving a runtime header, the module’s own imports when comparing.