Skip to content

import { default as ... } ... doesn't work as of 4.8.3Β #50690

@alecmev

Description

@alecmev

Bug Report

πŸ”Ž Search Terms

export default, import default as, namespace, declaration.

πŸ•— Version & Regression Information

This changed between versions 4.8.2 and 4.8.3.

⏯ Playground Link

I can't provide a link because both Bug Workbench and CodeSandbox still don't have 4.8.3.

πŸ’» Code

// @flatten-js/core/index.d.ts
declare namespace Flatten {
    class Polygon {
        constructor();
    }
}

export default Flatten;

Complete typings.

// index.ts
import { default as Flatten } from '@flatten-js/core';

const x = new Flatten.Polygon();

πŸ™ Actual behavior

I get the following error:

error TS2339: Property 'Polygon' does not exist on type ...

When looking at Flatten, it still has a default within, so I need to access Polygon with Flatten.default.Polygon.

πŸ™‚ Expected behavior

It gets unwrapped correctly, like in 4.8.2 and before. Right now I'm having to use the following workaround:

import { default as FlattenBad } from '@flatten-js/core';
const Flatten = FlattenBad as unknown as typeof FlattenBad.default;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions