UNPKG

type-samurai

Version:

Advanced utility types for Typescript

13 lines (12 loc) 295 B
/** * Returns a boolean whether the first string argument ends with the second one * @example * ```ts * // true * type Result = EndsWith<'Foobar', 'bar'> * ``` */ export type EndsWith< T extends string, Characters extends string > = T extends `${string}${Characters}` ? true : false;