mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 04:17:36 +00:00
Parameterized Array.d.ts so it shows proper types and not just any/any[]
This commit is contained in:
1 parent
f78d326102
commit
6547225e8d
2 files changed
+26
-19
No files matched your search
@@ -49,6 +49,13 @@ public final class GenericContext {
|
||||
* @return a context with applied bindings and bound fallbacks, or EMPTY singleton if receiverType is not generic
|
||||
*/
|
||||
public static GenericContext forReceiver(TypeInfo receiverType) {
|
||||
// Special edge case: Array.d.ts JS type, bind T to element type so Array<T> methods resolve correctly
|
||||
if (receiverType != null && receiverType.isArray() && receiverType.getElementType() != null) {
|
||||
Map<String, TypeInfo> applied = new HashMap<>();
|
||||
applied.put("T", receiverType.getElementType());
|
||||
return new GenericContext(applied, new HashMap<>());
|
||||
}
|
||||
|
||||
// Fast path: return singleton for non-generic types
|
||||
if (receiverType == null || !hasGenerics(receiverType)) {
|
||||
return EMPTY;
|
||||
|
||||
Reference in new issue
Block a user