Modern Full-Stack Development


A Few Interface for Good Measure



Download 5,64 Mb.
Pdf ko'rish
bet82/107
Sana06.08.2021
Hajmi5,64 Mb.
#140576
1   ...   78   79   80   81   82   83   84   85   ...   107
Bog'liq
Modern Full-Stack Development Using TypeScript, React, Node

 A Few Interface for Good Measure
Next up, we find a few interfaces. Note that these are in the TypeScript module that 
state.ts represents, but it’s not in the state object that will ultimately be constructed 
and used in the rest of the app:
interface ISelectedTile { layer: number,
  row: number, column: number, type: number }
interface IScores { player: number, opponent: number }
The first, ISelectedTile, is the definition for an object that describes a tile that is 
currently selected. It contains all the information that is needed to identify a tile (layer, 
row, and column) and it also contains the type of tile it is, and you’ll see why that is 
needed very soon.
The IScores interface describes an object that stores the current score of the player 
and the remote opponent.
Both of these are used to avoid duplication of code: without them, we’d need to 
copy and paste these type definitions in a couple of places in this file’s code – unless we 
wanted to skip typing entirely – neither of which is a great option in general.

Download 5,64 Mb.

Do'stlaringiz bilan baham:
1   ...   78   79   80   81   82   83   84   85   ...   107




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish