Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#61082 breaks @uswds/uswds deep module resolution in DT #61322

Closed
sandersn opened this issue Feb 28, 2025 · 1 comment
Closed

#61082 breaks @uswds/uswds deep module resolution in DT #61322

sandersn opened this issue Feb 28, 2025 · 1 comment

Comments

@sandersn
Copy link
Member

sandersn commented Feb 28, 2025

🔎 Search Terms

deep module resolution 61082

🕗 Version & Regression Information

💻 Code

#61082 breaks @uswds/uswds on Definitely Typed:

import("@uswds/uswds").then((imports) => {
    Object.keys(components).forEach((key) => {
        const component = imports[key as ComponentKey];
        component.on(); // $ExpectType void
        component.on(element); // $ExpectType void
        component.off(); // $ExpectType void
        component.off(element); // $ExpectType void
    });
});
import("@uswds/uswds/src/js/components").then((imports) => {
    Object.keys(components).forEach((key) => {
        const component = imports[key as ComponentKey];
        component.on(); // $ExpectType void
        component.on(element); // $ExpectType void
        component.off(); // $ExpectType void
        component.off(element); // $ExpectType void
    });
});

package.json doesn't have anything fancy that I can see:

{
    "private": true,
    "name": "@types/uswds__uswds",
    "version": "3.11.9999",
    "projects": [
        "https://github.com/uswds/uswds"
    ],
    "devDependencies": {
        "@types/uswds__uswds": "workspace:."
    },
    "owners": [
        {
            "name": "Morgan Spencer",
            "githubUsername": "lunchbreakdev"
        },
        {
            "name": "Andrew Duthie",
            "githubUsername": "aduth"
        }
    ]
}

🙁 Actual behavior

The first block here resolves "@uswds/uswds"; the second doesn't resolve "@uswds/uswds/src/js/components".

🙂 Expected behavior

Previously, the second block resolved.

Additional information about the issue

This is probably a good break, but I don't understand why.

@sandersn
Copy link
Member Author

"@uswds/uswds/src/js/components" should be "@uswds/uswds/src/js/components/index.js" for compatibility with ES module resolution. DefinitelyTyped/DefinitelyTyped#72083 fixes this on DT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant