在 TypeScript 中,当我想编辑文字类型时,它可以工作。
type Old = "helloWorld"
// ^? "helloWorld"
type New = `${Old}New`
// ^? "helloWorldNew"
Run Code Online (Sandbox Code Playgroud)
但我怎样才能做到这一点。
type Old = "helloWorld"
// ^? "helloWorld"
type New = Slice<"helloWorld",5> // < Is it possible
// ^? "World"
Run Code Online (Sandbox Code Playgroud)