Skip to content

Commit 43d6284

Browse files
author
Brian Kim
committed
avoid for...of in createElement
1 parent e5a481b commit 43d6284

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/crank.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,16 @@ export function createElement<TTag extends Tag>(
267267
props = {} as TagProps<TTag>;
268268
}
269269

270-
for (const propPrefix of DEPRECATED_PROP_PREFIXES) {
271-
for (const propName of SPECIAL_PROP_BASES) {
272-
const deprecatedPropName = propPrefix + propName;
270+
for (let i = 0; i < DEPRECATED_PROP_PREFIXES.length; i++) {
271+
const propPrefix = DEPRECATED_PROP_PREFIXES[i];
272+
for (let j = 0; j < SPECIAL_PROP_BASES.length; j++) {
273+
const propBase = SPECIAL_PROP_BASES[j];
274+
const deprecatedPropName = propPrefix + propBase;
273275
if (deprecatedPropName in (props as TagProps<TTag>)) {
274276
console.warn(
275-
`The \`${deprecatedPropName}\` prop is deprecated. Use \`${propName}\` instead.`,
277+
`The \`${deprecatedPropName}\` prop is deprecated. Use \`${propBase}\` instead.`,
276278
);
277-
(props as TagProps<TTag>)[propName] = (props as TagProps<TTag>)[
279+
(props as TagProps<TTag>)[propBase] = (props as TagProps<TTag>)[
278280
deprecatedPropName
279281
];
280282
}

0 commit comments

Comments
 (0)