Open zardoy opened 2 years ago
The last two examples also "fails" without Partial
, just added it to demonstrate where exactly it inserts <
. I find this behavior is inconsistent.
I admit I haven't been using generics too much so officially it's not supported. If it works then by coincidence :)
First two however seem to work as expected:
This might be tricky to get full support but I'll have a look on the AST of generics.
Hey, @ipatalas regarding type snippets, is this by design that identifier
postfixes are suggested in type references?
For example:
only type suggestions: type a = null
type & identifier suggestions: type a = a
in ast it's still a valid Identifier
, but as I understand they should be suggested for variableNames only
Well, the identifier
condition is basically a map to TS identifier in AST and Type is also an identifier:
I can see that README does not specify that very clearly and your interpretation makes absolute sense. The change should be relatively simple but it may be a breaking change for some users so I need to think if it's not gonna be a big deal.
I have
.t
snippet that I use to wrap types into generics e.g.SomeType.t -> Partial<SomeType>
, its really handy. However, I usually use it in combination withExtract
so I can reduce amount of fields passing to the generic above e.g.Partial
.Snippet:
Works:
Fails:
The same applies for
typeof
:Expected:
Hope I made it clear.