#Inferring the empty string

5 messages · Page 1 of 1 (latest)

next coral
frosty widgetBOT
#

@next coral Here's a shortened URL of your playground link! You can remove the full link from your message.

kartal8091#0

Preview:ts type A = "ab" extends `${infer _ extends "ab"}${infer B extends string}` ? B : never

tulip viper
#

Not too sure, it might be a bug
But since you don't want the first part of the string, just dont infer it

#
type A = "ab" extends `ab${infer B extends string}` ? B : never;

@next coral

next coral
#

I see. Nice workaround. Indeed feels like a flaw, as the behaviour does not happen if you use a single-char prefix. Thanks 🙂