When modifying or extending APIs, prioritize backward compatibility while providing clear migration paths for future changes. Follow these practices:
When modifying or extending APIs, prioritize backward compatibility while providing clear migration paths for future changes. Follow these practices:
// Good: Keeping backward compatibility with clear deprecation notice
export const isGloballyAllowed = /*#__PURE__*/ makeMap(GLOBALS_ALLOWED)
/** @deprecated use `isGloballyAllowed` instead */
export const isGloballyWhitelisted = isGloballyAllowed
// Good: Supporting both boolean and string namespace types
mount(
rootContainer: HostElement | string,
isHydrate?: boolean,
namespace?: ElementNamespace | boolean // Support both forms
) {
// Internally normalize boolean to string representation
if (typeof namespace === 'boolean') {
namespace = namespace ? 'svg' : undefined
}
// ...implementation
}
Consider custom renderer implementations when adding new methods to core interfaces, as they constitute breaking changes for implementers.
// Following HTML spec for boolean attribute behavior
if (name === 'bar' && value === '') {
// Treat empty string as true per HTML spec
return true
}
When uncertain about a change, consider adding a deprecation notice and providing the new approach in parallel rather than breaking existing code.
Enter the URL of a public GitHub repository