diff --git a/src/bindings/tsd.ts b/src/bindings/tsd.ts index 59b3362954..fc5c8a2e6b 100644 --- a/src/bindings/tsd.ts +++ b/src/bindings/tsd.ts @@ -302,17 +302,16 @@ export class TSDBuilder extends ExportsWalker { sb.push(mode == Mode.EXPORT ? "" : ""); } } else { - if (this.isPlainObject(clazz)) { - typeName = "__Record" + clazz.id.toString(); - sb.push(typeName); + let isPlain = this.isPlainObject(clazz); + typeName = `${isPlain ? "__Record" : "__Internref"}${clazz.id}`; + sb.push(typeName); + seenObjectTypes.set(clazz, typeName); + if (isPlain) { sb.push(mode == Mode.EXPORT ? "" : ""); this.deferredTypings.push(this.makeRecordType(clazz, mode)); } else { - typeName = "__Internref" + clazz.id.toString(); - sb.push(typeName); this.deferredTypings.push(this.makeInternrefType(clazz)); } - seenObjectTypes.set(clazz, typeName); } } if (type.is(TypeFlags.NULLABLE)) {