简体   繁体   English

如何继承 TypeScript 中的默认泛型类型?

[英]How to inherit the default generic types in TypeScript?

Does TypeScript have the null type that inherits the default generic types? TypeScript 是否具有继承默认泛型类型的 null 类型?

Example:例子:

type Foo<T = number, U = string> = { t: T, u: U }
type Bar = Foo<?, boolean> // Should be Foo<number, boolean>, but cannot input 'number'

As far as i know this is not possible right now.据我所知,现在这是不可能的。 This might be something that could be covered by partial type argument inference in the future.这可能是将来可以通过部分类型参数推断来涵盖的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM