ChatGPT Plus
Ese error de TypeScript:
Cannot find name 'StudentType'.
significa que estás usando un tipo llamado StudentType, pero no lo has definido ni
importado en ese archivo.
✅ Solución: Define el tipo StudentType
Tienes dos opciones:
✅ Opción 1: Definir el tipo directamente en el archivo [Link]
Agrega esto arriba del componente:
tsx
Copiar
Editar
type StudentType = {
id: number;
name: string;
place: string;
phone: string;
};
✅ Opción 2: Crear un archivo [Link] y exportarlo
📄 src/[Link]
ts
Copiar
Editar
export type StudentType = {
id: number;
name: string;
place: string;
phone: string;
};
Luego en [Link]:
tsx
Copiar
Editar
import { StudentType } from "../types"; // ajusta la ruta si es necesario
✅ Ejemplo completo en [Link]:
tsx
Copiar
Editar
import { StudentType } from "../types";
type Props = {
students: StudentType[];
};
const Table = ({ students }: Props) => {
return (
<table>
<tbody>
{[Link]((item) => (
<tr key={[Link]}>
<td>{[Link]}</td>
<td>{[Link]}</td>
<td>{[Link]}</td>
</tr>
))}
</tbody>
</table>
);
};
export default Table;