organizing type structure

This commit is contained in:
2022-07-16 14:10:45 -05:00
parent 77c3106a5a
commit e861cceda0
4 changed files with 27 additions and 17 deletions

View File

@@ -1,8 +0,0 @@
declare namespace CardInfo {
export interface Card {
gemValue: string
tier: number
points?: number
cost: any
}
}

View File

@@ -1,6 +1,6 @@
/// <reference path="Card.d.ts" />
/// <reference path="../../util/main.d.ts" />
export default function Card(data: CardInfo.Card) {
export default function Card(data: Universals.Card) {
return (
<div className="card">
<p>{data.gemValue}</p>

View File

@@ -1,13 +1,9 @@
/// <reference path="Gameboard.d.ts" />
/// <reference path="../Card/Card.d.ts" />
import { useState, useEffect } from "react"
/// <reference path="../../util/main.d.ts" />
export default function Gameboard() {
const [cards, setCards] = useState();
const exampleCard: CardInfo.Card = {
gemValue: "ruby",
const exampleCard: Universals.Card = {
gemValue: Universals.GemValue.Ruby,
tier: 1,
cost: 5
}

22
src/util/main.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
declare namespace Universals {
export interface Card {
gemValue: GemValue
tier: number
points?: number
cost: any
}
export interface Nobles {
points: 3
}
export enum GemValue {
Ruby,
Sapphire,
Emerald,
Diamond,
Onyx,
Gol,
}
}