Skip to content

Commit f7762cc

Browse files
committed
Guard against invalid values in config
1 parent 74673be commit f7762cc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/@tailwindcss-upgrade/src/codemods/config/migrate-js-config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,16 @@ async function migrateTheme(
144144

145145
// We don't read from the `--content` key in v4 for the content-* utilities
146146
// so we must convert these to custom utilities instead.
147-
if ('content' in resolvedConfig.theme) {
147+
if (
148+
'content' in resolvedConfig.theme &&
149+
resolvedConfig.theme.content !== null &&
150+
typeof resolvedConfig.theme.content === 'object'
151+
) {
148152
let rules: AstNode[] = []
149153

150154
for (let [key, value] of Object.entries(resolvedConfig.theme.content)) {
155+
if (typeof value !== 'string') continue
156+
151157
rules.push(
152158
atRule('@utility', `content-${key}`, [
153159
decl('--tw-content', `${value}`),

0 commit comments

Comments
 (0)