TheSnegok
@TheSnegok

Правильно ли типизирован массив строк?

Typescript не ругается, но при передаче его через пропсы ругается что нужно всё типизировать как string | string[]:
const projectInfo: (string | string[])[][] = [['Registration form', 'Page with registration form of four fields, which displays an error notification if it is incorrectly filled.', ['Javascript', 'CSS']], ['Giphy', 'Page for search and watch gif files, from Giphy API. Multiple language and may copy gif.', ['React', 'Redax', 'Axios', 'CSS']], ['Landing Glopt', 'A page with several section, addaptation for any device.', ['Javascript', 'SASS', 'GULP']], ['Project Euler', 'Answers and solutions to problems of the famous Euler project.', ['Javascript']]
];
  • Вопрос задан
  • 62 просмотра
Решения вопроса 1
bingo347
@bingo347 Куратор тега TypeScript
Crazy on performance...
Лучше сделать более точный тип:[string, string, string[]][]
https://www.typescriptlang.org/play?#code/MYewdgzg...
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы