ts-json-schema-generator icon indicating copy to clipboard operation
ts-json-schema-generator copied to clipboard

bug: Identifiers can't be parsed cross module boundaries

Open DarkPurple141 opened this issue 2 years ago • 2 comments

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.

DarkPurple141 avatar Feb 07 '23 09:02 DarkPurple141

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

domoritz avatar Feb 07 '23 17:02 domoritz