/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/components/src/context/test/wordpress-component.tsx
27 строк
829 B
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import type { ForwardedRef } from 'react'; import { forwardRef } from '@wordpress/element'; import type { WordPressComponentProps } from '../wordpress-component'; // Static TypeScript checks /* eslint-disable jest/expect-expect */ describe( 'WordPressComponentProps', () => { it( 'should not accept a ref', () => { const Foo = ( props: WordPressComponentProps< {}, 'div' > ) => ( <div { ...props } /> ); // @ts-expect-error The ref prop should trigger an error. <Foo ref={ null } />; } ); it( 'should accept a ref if wrapped by a forwardRef()', () => { const Foo = ( props: WordPressComponentProps< {}, 'div' >, ref: ForwardedRef< any > ) => <div { ...props } ref={ ref } />; const ForwardedFoo = forwardRef( Foo ); <ForwardedFoo ref={ null } />; } ); } ); /* eslint-enable jest/expect-expect */