/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
shared/lib/array.ts
11 строк
499 B
Paweł Kuna
Enable `astro/tsconfigs/strictest` in the preview package (#2834)
08 авг 2026, 01:51
Не верифицирован
08 авг 2026, 01:51
16e1403
Код
Авторство
О чём код?
// Indexes into demo-data arrays (people.json, photos.json, …) that pages trust to have // an entry at a given position. Throws instead of silently rendering `undefined` if that // assumption is ever violated (e.g. a seed file shrinks). export function requireIndex<T>(array: readonly T[], index: number): T { const item = array[index] if (item === undefined) { throw new Error(`Expected an entry at index ${index}, got undefined (array has ${array.length} entries)`) } return item }