INNER CODE UNIT · TypeScript
getClassError
ben-rogerson/twin.macro · src/suggestions/index.ts:58
function getClassError(rawClass: string, context: ClassErrorContext): string {
const input = rawClass.replace(ALL_SPACE_IDS, ' ')
const classPieces = [
...splitAtTopLevelOnly(input, context.tailwindConfig.separator ?? ':'),
]
for (const validator of validators) {
const error = validator(classPieces, context)
if (error) return error
}
const className = classPieces.slice(-1).join('')
const variants = classPieces.slice(0, -1)
// Check if variants or classes with match issues
if (variants.length > 0) {
const variantSuggestions = getVariantSuggestions(