Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Working C# equivalent:
- public class BaseInterface
- {
- public string Name { get; set; }
- }
- public T getMeObject<T>() where T : BaseInterface, new()
- {
- return new T { Name = "WUT" };
- }
- Not working Typescript:
- interface BaseInterface {
- Name: string;
- }
- function getMeObject<T extends BaseInterface>(): T {
- // {...} cannot be converted into T
- return {
- Name: "omg"
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement