Skip to content

fix some template only args references #287

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

Merged
merged 1 commit into from
Jun 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/main/kotlin/com/emberjs/utils/EmberUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class EmberUtils {
if (cls is TypeScriptVariable) {
if (cls.jsType.toString().startsWith("TOC<") || cls.jsType.toString().startsWith("TemplateOnlyComponent<")) {
val arg = (cls.jsType as JSGenericTypeImpl).arguments[0]
return arg.asRecordType().properties.find { it.memberName == "Args" }?.jsType?.asRecordType()
return arg.asRecordType().properties.find { it.memberName == "Args" }?.jsType?.asRecordType() ?: arg.asRecordType()
}
return cls.jsType?.asRecordType()?.callSignatures?.firstOrNull()?.returnType?.asRecordType()?.properties?.find { it.memberName == "Context" }?.jsType?.asRecordType()?.properties?.find { it.memberName == "args" }?.jsType?.asRecordType()
}
Expand Down Expand Up @@ -958,8 +958,9 @@ class EmberUtils {
}
}
val tsClass = (cls as? JSClass)
var blocks: JSRecordType. PropertySignature? = null
var args: JSRecordType. PropertySignature? = null
var blocks: JSRecordType.PropertySignature? = null
var args: JSRecordType.PropertySignature? = null
var arg: JSType? = null
val supers = tsClass?.superClasses?.asList()?.toTypedArray<JSClass>()
val classes = mutableListOf<JSClass?>()
classes.add(tsClass)
Expand All @@ -974,7 +975,7 @@ class EmberUtils {
}
if (cls is TypeScriptVariable) {
if (cls.jsType.toString().startsWith("TOC<") || cls.jsType.toString().startsWith("TemplateOnlyComponent<")) {
val arg = (cls.jsType as JSGenericTypeImpl).arguments[0]
arg = (cls.jsType as JSGenericTypeImpl).arguments[0]
blocks = arg.asRecordType().properties.find { it.memberName == "Blocks" }
args = arg.asRecordType().properties.find { it.memberName == "Args" }
}
Expand All @@ -985,8 +986,8 @@ class EmberUtils {
it.memberSource.singleElement?.let { tplYields.add(EmberXmlElementDescriptor.YieldReference(it)) }
}
}
if (args != null) {
val arguments = args?.jsType?.asRecordType()?.properties
if (args != null || arg != null) {
val arguments = args?.jsType?.asRecordType()?.properties ?: args?.jsType?.asRecordType()?.properties
arguments?.forEach {
if (it.memberSource.singleElement != null) {
tplArgs.add(ArgData(it.memberName, "", AttrPsiReference(it.memberSource.singleElement!!)))
Expand Down
Loading