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 with Extract so I can reduce amount of fields passing to the generic above e.g. Partial.
Snippet:
{
"name": "t",
"description": "",
"body": "$1<{{expr}}>$2",
"when": ["type"]
}
Works:
Extract<Config.t, ''> -> Extract<<Config>, ''>
Fails:
Extract<Config[''].t, ''> -> <Extract<Config['']>, ''> // notice incorrect insertion of opening <
The same applies for typeof:
Partial<Extract<typeof config.t, ''>> -> Partial<<Extract<typeof config>, ''>>
Expected:
Partial<Extract<typeof config.t, ''>> -> Partial<Extract<<typeof config>, ''>>
Hope I made it clear.
I have
.tsnippet that I use to wrap types into generics e.g.SomeType.t -> Partial<SomeType>, its really handy. However, I usually use it in combination withExtractso I can reduce amount of fields passing to the generic above e.g.Partial.Snippet:
{ "name": "t", "description": "", "body": "$1<{{expr}}>$2", "when": ["type"] }Works:
Fails:
The same applies for
typeof:Expected:
Hope I made it clear.