dynamic import
type union
no export
export {}
export default {}
No response
๐ป Codereproduce.ts
async function optionalImport(id: string) { switch (id) { case 'a': return await import('./a.js') case 'a.test': return await import('./a.test.js') } throw new Error() } export { optionalImport }
a.ts
๐ Actual behaviora.test.ts
import { foo } from './a.js' describe('reproduce', () => { it('reproduce', () => { foo }) })
type is
function optionalImport(id: string): Promise<typeof import("/path/to/reproduce/a.test")>
a.test.ts
import { foo } from './a.js' describe('reproduce', () => { it('reproduce', () => { foo }) }) export {}
type is
function optionalImport(id: string): Promise<typeof import("/path/to/reproduce/a.test")>
a.test.ts
import { foo } from './a.js' describe('reproduce', () => { it('reproduce', () => { foo }) }) export default {}
type is
function optionalImport(id: string): Promise<typeof import("/path/to/reproduce/a") | typeof import("/path/to/reproduce/a.test")>๐ Expected behavior
When a.test.ts
import { foo } from './a.js' describe('reproduce', () => { it('reproduce', () => { foo }) })
type is
function optionalImport(id: string): Promise<typeof import("/path/to/reproduce/a") | typeof import("/path/to/reproduce/a.test")>Additional information about the issue
No response
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4