{"id":22414,"library":"string-utility-types","title":"string-utility-types","description":"A TypeScript utility library providing advanced string type manipulations via template literal types. Version 2.1.0 offers types like Split, Join, ReplaceAt, and path matching utilities (MatchesPathPattern, MatchesPathPatternLax) for compile-time string processing. Released under MIT, it is actively maintained with a focus on type safety for routing and string operations. Unlike similar libraries, it provides conservative path pattern matching to avoid false negatives, with explicit documentation of limitations. Recommended for TypeScript projects needing robust string type inference.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript","utility","types"],"install":[{"cmd":"npm install string-utility-types","lang":"bash","label":"npm"},{"cmd":"yarn add string-utility-types","lang":"bash","label":"yarn"},{"cmd":"pnpm add string-utility-types","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Use named import; no default export.","wrong":"import Split from 'string-utility-types'","symbol":"Split","correct":"import { Split } from 'string-utility-types'"},{"note":"Use named import; no default export.","wrong":"import Join from 'string-utility-types'","symbol":"Join","correct":"import { Join } from 'string-utility-types'"},{"note":"Conservative path matcher; returns true for some non-exact matches.","symbol":"MatchesPathPattern","correct":"import { MatchesPathPattern } from 'string-utility-types'"}],"quickstart":{"code":"import { Split, Join, MatchesPathPattern, MatchesPathPatternLax } from 'string-utility-types';\n\n// Example usage\ntype Path = 'home/user/docs';\ntype Parts = Split<Path, '/'>; // ['home', 'user', 'docs']\ntype Rejoined = Join<Parts, '-'>; // 'home-user-docs'\ntype IsMatch = MatchesPathPattern<'/users/123', '/users/:id'>; // true\ntype IsMatchLax = MatchesPathPatternLax<'/users/123', '/users/:id'>; // true\n\n// Note: MatchesPathPattern may return true for interpolated strings\n// e.g., MatchesPathPattern<\"/users/${string}\", '/users/:id'> is true\n// Use MatchesPathPatternLax if you know interpolations have no slashes.","lang":"typescript","description":"Demonstrates basic usage of Split, Join, and path matching types from string-utility-types."},"warnings":[{"fix":"Use MatchesPathPatternLax if you can guarantee no slashes in interpolations.","message":"MatchesPathPattern is conservative and may return true for paths that technically could match due to string interpolation (e.g., `${string}` could be `/123/author`).","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Break down path patterns or use a different type for longer paths.","message":"MatchesPathPattern only works up to 6 path segments. Beyond that, behavior is undefined.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Update named imports to current API; see migration guide.","message":"Version 2.0.0 removed deprecated types from v1 (e.g., older Split/Join implementations) – updates may break code relying on old signatures.","severity":"breaking","affected_versions":"2.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure S and Delimiter are string literals, e.g., Split<'a/b', '/'>","cause":"Using Split on a non-string type or with invalid delimiter.","error":"Type 'Split<...>' does not satisfy the constraint 'string[]'."},{"fix":"Limit string length or use simpler types; avoid nesting.","cause":"Recursive type evaluation on very long strings or deep arrays.","error":"Type instantiation is excessively deep and possibly infinite."},{"fix":"Use 'import { Split } from 'string-utility-types'.","cause":"Using default import instead of named import.","error":"Cannot find name 'Split'. Did you mean 'split'?"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}