Closed as not planned
Description
🔎 Search Terms
inference
"type cannot be named"
"package exports"
🕗 Version & Regression Information
I don't know if this is a bug or a feature request. The behaviour seems wrong to me but I am not aware of a reference/documentation actually stating how its supposed to work so...
⏯ Playground Link
https://github.com/jasonkuhrt/repro-ts-lib-types-reference
💻 Code
Check the repo as the scenario spans multiple modules and packages to reproduce.
🙁 Actual behavior
In short I expect that as a library author types exported like as follows will be "nameable" in inference cases in downstream consumer code:
Library Package:
// index.ts
export * as Bar from './bar.ts
// bar.ts
export interface A {}
Project Package:
// main.ts
import * as Thing from './thing.js'
import * as Resources from './resources.js'
const thing = Thing.create(Resources.A)
// ^^^^^ "... cannot be named ..." error
// thing.ts
export create = <t>(t:t)=>t
// resources.ts
import { Bar } from 'library-package'
declare const A: Bar.A
🙂 Expected behavior
I expect thing
to infer to Bar.A
just fine.
Additional information about the issue
Really curious about this one!