@@ -1704,6 +1704,24 @@ public struct BridgeJSLink {
17041704 }
17051705 }
17061706 return type. tsType
1707+ case . swiftStruct( let name) :
1708+ for skeleton in exportedSkeletons {
1709+ for structDef in skeleton. structs {
1710+ if structDef. name == name || structDef. swiftCallName == name {
1711+ return structDef. tsFullPath
1712+ }
1713+ }
1714+ }
1715+ return type. tsType
1716+ case . swiftHeapObject( let name) :
1717+ for skeleton in exportedSkeletons {
1718+ for klass in skeleton. classes {
1719+ if klass. name == name || klass. swiftCallName == name {
1720+ return klass. name
1721+ }
1722+ }
1723+ }
1724+ return type. tsType
17071725 case . alias( _, let underlying) :
17081726 return resolveTypeScriptType ( underlying, exportedSkeletons: exportedSkeletons)
17091727 case . nullable( let wrapped, let kind) :
@@ -2903,7 +2921,7 @@ extension BridgeJSLink {
29032921 let namespaceEnumPaths = skeleton. enums
29042922 . filter { $0. enumType == . namespace }
29052923 . filter { !$0. staticProperties. isEmpty || !$0. staticMethods. isEmpty }
2906- . map { ( $0 . namespace ?? [ ] ) + [ $0 . name ] }
2924+ . map ( \ . tsPathComponents )
29072925
29082926 return itemNamespaces + namespaceEnumPaths
29092927 }
@@ -2961,15 +2979,13 @@ extension BridgeJSLink {
29612979 }
29622980 for enumDef in skeleton. enums where enumDef. enumType == . namespace {
29632981 for function in enumDef. staticMethods {
2964- let fullNamespace = ( enumDef. namespace ?? [ ] ) + [ enumDef. name]
2965- let namespacePath = fullNamespace. joined ( separator: " . " )
2982+ let namespacePath = enumDef. tsFullPath
29662983 printer. write (
29672984 " globalThis. \( namespacePath) . \( function. resolvedJSName) = exports. \( namespacePath) . \( function. resolvedJSName) ; "
29682985 )
29692986 }
29702987 for property in enumDef. staticProperties {
2971- let fullNamespace = ( enumDef. namespace ?? [ ] ) + [ enumDef. name]
2972- let namespacePath = fullNamespace. joined ( separator: " . " )
2988+ let namespacePath = enumDef. tsFullPath
29732989 let exportsPath = " exports. \( namespacePath) "
29742990
29752991 printer. write (
@@ -3082,15 +3098,15 @@ extension BridgeJSLink {
30823098
30833099 for klass in skeleton. classes {
30843100 var currentNode = rootNode
3085- for part in ( klass. namespace ?? [ ] ) + [ klass . name ] {
3101+ for part in klass. tsPathComponents {
30863102 currentNode = currentNode. addChild ( part)
30873103 }
30883104 currentNode. content. declaration = . classType( klass)
30893105 }
30903106
30913107 for structDef in skeleton. structs {
30923108 var currentNode = rootNode
3093- for part in ( structDef. namespace ?? [ ] ) + [ structDef . name ] {
3109+ for part in structDef. tsPathComponents {
30943110 currentNode = currentNode. addChild ( part)
30953111 }
30963112 currentNode. content. declaration = . structType( structDef)
@@ -3106,17 +3122,15 @@ extension BridgeJSLink {
31063122
31073123 for enumDef in skeleton. enums where enumDef. enumType == . namespace {
31083124 for property in enumDef. staticProperties {
3109- let fullNamespace = ( enumDef. namespace ?? [ ] ) + [ enumDef. name]
31103125 var currentNode = rootNode
3111- for part in fullNamespace {
3126+ for part in enumDef . tsPathComponents {
31123127 currentNode = currentNode. addChild ( part)
31133128 }
31143129 currentNode. content. staticProperties. append ( property)
31153130 }
31163131 for function in enumDef. staticMethods {
3117- let fullNamespace = ( enumDef. namespace ?? [ ] ) + [ enumDef. name]
31183132 var currentNode = rootNode
3119- for part in fullNamespace {
3133+ for part in enumDef . tsPathComponents {
31203134 currentNode = currentNode. addChild ( part)
31213135 }
31223136 currentNode. content. functions. append ( function)
0 commit comments