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

bug: Identifiers can't be parsed cross module boundaries #1560

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

DarkPurple141
Copy link

This is a minimal reproduction of existing behavior around the NodeParser throwing an UnknownNodeError for valid in scope identifiers.

eg.

// module.ts
const y = "hello";

export const x = {
    z: y,
};
// main.ts
import { x } from "./module";

type Identifier = typeof x;

export interface MyObject {
    field: Identifier;
}

Error:

Unknown node " y" of kind "Identifier"

My expectation of is that this would be able to be parsed - as this kind of type inference via an identifier is a common use case.

@@ -49,6 +49,7 @@ describe("valid-data-other", () => {
it("import-exposed", assertValidSchema("import-exposed", "MyObject"));
it("import-internal", assertValidSchema("import-internal", "MyObject", "basic"));
it("import-anonymous", assertValidSchema("import-anonymous", "MyObject"));
it.only("import-identifier", assertValidSchema("import-identifier", "MyObject"));
Copy link
Author

Choose a reason for hiding this comment

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

will remove this later

@domoritz
Copy link
Member

domoritz commented Feb 7, 2023

Thanks for the repro. This will Haley confirm the fix later.

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

Successfully merging this pull request may close these issues.

None yet

2 participants