( key: DeprecationTypes, instance: ComponentInternalInstance | null, enableForBuiltIn = false, )
| 564 | } |
| 565 | |
| 566 | export function isCompatEnabled( |
| 567 | key: DeprecationTypes, |
| 568 | instance: ComponentInternalInstance | null, |
| 569 | enableForBuiltIn = false, |
| 570 | ): boolean { |
| 571 | // skip compat for built-in components |
| 572 | if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) { |
| 573 | return false |
| 574 | } |
| 575 | |
| 576 | const rawMode = getCompatConfigForKey('MODE', instance) || 2 |
| 577 | const val = getCompatConfigForKey(key, instance) |
| 578 | |
| 579 | const mode = isFunction(rawMode) |
| 580 | ? rawMode(instance && instance.type) |
| 581 | : rawMode |
| 582 | |
| 583 | if (mode === 2) { |
| 584 | return val !== false |
| 585 | } else { |
| 586 | return val === true || val === 'suppress-warning' |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | /** |
| 591 | * Use this for features that are completely removed in non-compat build. |
no test coverage detected