millsp / ts-toolbelt

👷 TypeScript's largest type utility library

Home Page:https://millsp.github.io/ts-toolbelt/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

String.StartsWith?

jasonkuhrt opened this issue · comments

🍩 Feature Request

Is your feature request related to a problem?

Need this type for working with string literals:

	export type StartsWith<Prefix extends string, S extends string> = 
		Prefix extends `${infer head1}${infer tail1}` ?
			S extends `${infer head2}${infer tail2}` ?
				head1 extends head2 ?
					StartsWith<tail1,tail2>
				: false
			: false
		: true

Something that could go into the library here?

Describe the solution you'd like

Describe alternatives you've considered

Teachability, Documentation, Adoption, Migration Strategy