Skip to content

PLASMA-5871: add polymorphic type to component#2689

Open
TitanKuzmich wants to merge 2 commits intodevfrom
PLASMA-5871
Open

PLASMA-5871: add polymorphic type to component#2689
TitanKuzmich wants to merge 2 commits intodevfrom
PLASMA-5871

Conversation

@TitanKuzmich
Copy link
Copy Markdown
Contributor

@TitanKuzmich TitanKuzmich commented Apr 10, 2026

Core

Typings

  • добавлен тип для полиморфных компонентов со свойством as

What/why changed

добавлен тип для полиморфных компонентов со свойством as

polymorphic-button

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @salutejs/plasma-asdk@0.372.0-canary.2689.24330727923.0
npm install @salutejs/plasma-b2c@1.614.0-canary.2689.24330727923.0
npm install @salutejs/plasma-core@1.223.0-canary.2689.24330727923.0
npm install @salutejs/plasma-giga@0.341.0-canary.2689.24330727923.0
npm install @salutejs/plasma-homeds@0.341.0-canary.2689.24330727923.0
npm install @salutejs/plasma-hope@1.369.0-canary.2689.24330727923.0
npm install @salutejs/plasma-icons@1.235.0-canary.2689.24330727923.0
npm install @salutejs/plasma-new-hope@0.358.0-canary.2689.24330727923.0
npm install @salutejs/plasma-tokens@1.135.0-canary.2689.24330727923.0
npm install @salutejs/plasma-ui@1.345.0-canary.2689.24330727923.0
npm install @salutejs/plasma-web@1.616.0-canary.2689.24330727923.0
npm install @salutejs/sdds-bizcom@0.346.0-canary.2689.24330727923.0
npm install @salutejs/sdds-cs@0.350.0-canary.2689.24330727923.0
npm install @salutejs/sdds-dfa@0.344.0-canary.2689.24330727923.0
npm install @salutejs/sdds-finai@0.337.0-canary.2689.24330727923.0
npm install @salutejs/sdds-insol@0.341.0-canary.2689.24330727923.0
npm install @salutejs/sdds-netology@0.345.0-canary.2689.24330727923.0
npm install @salutejs/sdds-os@0.16.0-canary.2689.24330727923.0
npm install @salutejs/sdds-platform-ai@0.345.0-canary.2689.24330727923.0
npm install @salutejs/sdds-sbcom@0.345.0-canary.2689.24330727923.0
npm install @salutejs/sdds-scan@0.344.0-canary.2689.24330727923.0
npm install @salutejs/sdds-serv@0.345.0-canary.2689.24330727923.0
npm install @salutejs/plasma-themes@0.47.0-canary.2689.24330727923.0
npm install @salutejs/sdds-themes@0.62.0-canary.2689.24330727923.0
npm install @salutejs/sdds-api-tests@0.3.0-canary.2689.24330727923.0
npm install @salutejs/plasma-cy-utils@0.153.0-canary.2689.24330727923.0
npm install @salutejs/plasma-sb-utils@0.223.0-canary.2689.24330727923.0
# or 
yarn add @salutejs/plasma-asdk@0.372.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-b2c@1.614.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-core@1.223.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-giga@0.341.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-homeds@0.341.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-hope@1.369.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-icons@1.235.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-new-hope@0.358.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-tokens@1.135.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-ui@1.345.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-web@1.616.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-bizcom@0.346.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-cs@0.350.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-dfa@0.344.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-finai@0.337.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-insol@0.341.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-netology@0.345.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-os@0.16.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-platform-ai@0.345.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-sbcom@0.345.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-scan@0.344.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-serv@0.345.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-themes@0.47.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-themes@0.62.0-canary.2689.24330727923.0
yarn add @salutejs/sdds-api-tests@0.3.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-cy-utils@0.153.0-canary.2689.24330727923.0
yarn add @salutejs/plasma-sb-utils@0.223.0-canary.2689.24330727923.0

@github-actions
Copy link
Copy Markdown
Contributor

Theme Builder app deployed!

https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-2689/

@github-actions
Copy link
Copy Markdown
Contributor

Documentation preview deployed!

website: https://plasma.sberdevices.ru/pr/pr-2689/
asdk storybook: https://plasma.sberdevices.ru/pr/pr-2689/asdk-storybook/
b2c storybook: https://plasma.sberdevices.ru/pr/pr-2689/b2c-storybook/
giga storybook: https://plasma.sberdevices.ru/pr/pr-2689/giga-storybook/
homeds storybook: https://plasma.sberdevices.ru/pr/pr-2689/homeds-storybook/
new-hope storybook: https://plasma.sberdevices.ru/pr/pr-2689/new-hope-storybook/
web storybook: https://plasma.sberdevices.ru/pr/pr-2689/web-storybook/
sdds-bizcom storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-bizcom-storybook/
sdds-cs storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-cs-storybook/
sdds-dfa storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-dfa-storybook/
sdds-finai storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-finai-storybook/
sdds-insol storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-insol-storybook/
sdds-netology storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-netology-storybook/
sdds-os storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-os-storybook/
sdds-platform-ai storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-platform-ai-storybook/
sdds-sbcom storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-sbcom-storybook/
sdds-scan storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-scan-storybook/
sdds-serv storybook: https://plasma.sberdevices.ru/pr/pr-2689/sdds-serv-storybook/
ui storybook: https://plasma.sberdevices.ru/pr/pr-2689/ui-storybook/

@@ -1,4 +1,5 @@
import { buttonConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { MakePolymorphic } from '@salutejs/plasma-new-hope/styled-components';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Типы импортируем просто из @salutejs/plasma-new-hope

* Кнопка.
*/
export const Button = ButtonComponent;
export const Button = (ButtonComponent as unknown) as MakePolymorphic<typeof ButtonComponent, 'button'>;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Похоже не работает как задумано, и !обязательно! заведите отдельный блок под as в апи-тестах с разными наборами тегов.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants