Skip to content

Support for literal template strings? #14221

Discussion options

You must be logged in to vote

you can do this with a match type:

import scala.compiletime.ops.string.+

type OfString[S <: String] = S
type Spread[S <: String, T <: NonEmptyTuple] = T match
  case OfString[t] *: EmptyTuple => S + t
  case OfString[t] *: ts => (S + t) | Spread[S, ts]

type Grays = Spread["gray-", ("50", "75", "100", "200")]

val `gray-50`: Grays = "gray-50"

then you can use this as a template to support more than one splice

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 3xau1o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants