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

fix: Import local type from module and namespace #1099

Merged
merged 9 commits into from
Oct 16, 2023
Merged

Conversation

sunrabbit123
Copy link
Collaborator

Description:

declare module "foo2" {
    namespace Bar {
        interface I {
            a: string;
            b: number;
        }
    }

    namespace Baz {
        interface J {
            a: number;
            b: string;
        }
    }

    class Bar {
        item: Bar.I;
        constructor(input: Baz.J);
    }
}

let y: import("foo2").Bar.I = { a: "", b: 0 };

BREAKING CHANGE:

Related issue (if exists):

@changeset-bot
Copy link

changeset-bot bot commented Oct 10, 2023

⚠️ No Changeset found

Latest commit: df50410

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link

github-actions bot commented Oct 10, 2023

Thank you for the PR!
Commit: df50410

Files to check

These are files which is affected by the current PR, but not reflected. If there's no file below this message, please ignore this message.

You can run ./scripts/auto-unignore.sh from crates/stc_ts_file_analyzer for typescript files, and ./scripts/check.sh from crates/stc_ts_type_checker for *.stats.rust-debug files.

@@ -3053,16 +3053,22 @@ impl Analyzer<'_, '_> {
if let Some(vars) = exports.vars.get(sym).cloned() {
return Ok(vars);
}

for (id, tys) in exports.private_types.iter() {
if id.sym().eq(sym) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use == instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason other than readability?

@sunrabbit123 sunrabbit123 added this to the v0.0.1: Correctness milestone Oct 13, 2023
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kdy1 kdy1 changed the title fix: import local type from module and namespace fix: Import local type from module and namespace Oct 16, 2023
@kdy1 kdy1 merged commit b81ae80 into dudykr:main Oct 16, 2023
9 checks passed
@sunrabbit123 sunrabbit123 deleted the fix8 branch October 16, 2023 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants