Comments (9)
生成DOTween这种直接声明文件时, $Extension不仅扩展了基类, 还扩展了每个子类, 导致冲突
from puerts.
DOTween是哪个版本呢?
unity是哪个版本呢?
from puerts.
Unity2019.4.5 DOTween 1.0
from puerts.
有没有独立的可复现版本。
我这边自己写了个这样的类没问题。
public class A { }
public class B : A { }
public static class C
{
public static void pp(this A b) { }
public static void pp1(this B b) { }
public static void pp2(this string b) { }
}
from puerts.
我可以复现
from puerts.
感觉像是 $Extension 函数中
type $Extension<T1, T2> = {
[P in keyof T2] : T2[P] extends (obj:T1//** 要严格相等 **//, ...args: infer P) => infer R ? (...args: P) => R : never;
}
原因是 ts 参数类型是双向协变的,导致 T1 的子类兼容 T1。
from puerts.
感觉像是 $Extension 函数中
type $Extension<T1, T2> = { [P in keyof T2] : T2[P] extends (obj:T1//** 要严格相等 **//, ...args: infer P) => infer R ? (...args: P) => R : never; }原因是 ts 参数类型是双向协变的,导致 T1 的子类兼容 T1。
T1确实没严格匹配上, 导致所有方法都被扩展到了不同类型里
from puerts.
还有一个问题,ts 判断类型相等靠的是判断类型里所有的 key 的类型是否相等。
所以,那一堆空类就全是相等的。
#79
from puerts.
type $Extension<T1, T2> = {
[K in keyof T2]: Equals<ArgumentTypes<T2[K]>[0], T1> extends true ? (T2[K] extends (obj: T1, ...args: infer P) => infer R ? (...args: P) => R : never) : never;
}
type ArgumentTypes<F> = F extends (...args: infer A) => any ? A : never;
type Equals<X, Y> =
(<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
这样应该可以解决。
不过要把 #79 这个先修了。
from puerts.
Related Issues (20)
- [UE] Bug: 为ts UMG创建子类,蓝图全编译报循环引用错误 HOT 4
- [UE] Bug: JsEnvImpl的构造函数在纯v8的环境下没有正确处理传入的InFlags HOT 4
- [UE] 蓝图代理的方法能否支持默认值 HOT 1
- [UE] Bug: 在setTimeout中清理自身后,嵌套的setInterval和setTimeout不会执行 HOT 2
- [UE] Bug: console.log setTimeout 让UMG引用增加无法卸载 HOT 1
- [Unity] Bug: $typeof 操作嵌套命名空间内的类型时返回 undefined HOT 3
- [UE] 有关于新的定时器id复用机制容易导致错误清除的问题 HOT 13
- [Unity]/[UE] suggestion 创建jsenv时候增加一些优化参数如:set_max_old_generation_size_in_bytes HOT 2
- [UE] Bug: ue_bp.d.ts在引用插件里蓝图的地方报错,请问有什么比较好的解决办法 HOT 4
- [UE] Bug: promises.js,没有同步Unity下, kPromiseRejectWithNoHandler run after all microtasks 的修改 HOT 2
- [UE] Bug: Mixin 基类,PIE第二次启动后会崩溃 HOT 5
- [UE] suggestion 建议将用户js目录移动一下 HOT 2
- [UE] Bug: mixin 覆盖的函数中调用super 异常 HOT 2
- [Unity] General Questions HOT 5
- [UE] Bug: 使用Puerts Axios Http上传文件的问题 HOT 3
- [Question] Does the project use IPC or embedded process? HOT 1
- [UE] Bug: error: no template named 'result_of' HOT 1
- [UE] Bug: Dynamic Delegate无法区分MulticastDelegate和Single Delegate
- [UE] Delegate 绑定时,应该识别其是否已经在C++那Clear了
- [UE] Bug: Mixin实例持有的js实例丢失了 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puerts.