diff --git a/src/NodeApi.Generator/TypeDefinitionsGenerator.cs b/src/NodeApi.Generator/TypeDefinitionsGenerator.cs index c48e9d42..6a28d8dc 100644 --- a/src/NodeApi.Generator/TypeDefinitionsGenerator.cs +++ b/src/NodeApi.Generator/TypeDefinitionsGenerator.cs @@ -1897,9 +1897,12 @@ private string FormatTSType( NullabilityInfo? nullability, bool allowTypeParams = true) { + // Types exported from a module are not namespaced. + string nsPrefix = !_isModule && type.Namespace != null ? type.Namespace + '.' : ""; + string tsType = type.IsNested ? GetTSType(type.DeclaringType!, null, allowTypeParams) + '.' + type.Name : - (type.Namespace != null ? type.Namespace + '.' + type.Name : type.Name); + nsPrefix + type.Name; int typeNameEnd = tsType.IndexOf('`'); if (typeNameEnd > 0) diff --git a/test/TypeDefsGeneratorTests.cs b/test/TypeDefsGeneratorTests.cs index 14d57633..003571c5 100644 --- a/test/TypeDefsGeneratorTests.cs +++ b/test/TypeDefsGeneratorTests.cs @@ -198,7 +198,7 @@ public void GenerateGenericClass() /** generic-class */ export class GenericClass$1 implements GenericInterface$1 { /** constructor */ - new(value: T): GenericClass$1; + constructor(value: T); /** instance-property */ TestProperty: T;