maxrohleder / ccu2020

This is the source code repository for the user centered design course 2020 at IST lisbon.
1 stars 1 forks source link

fix TS error by using correct typing #16

Open maxrohleder opened 3 years ago

maxrohleder commented 3 years ago
144 MockCountryData["Portugal"]["generalRestrictions"].push(news1);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/mock-objects/countryData.ts:145:1 - error TS7053: Element implicitly has an 'any' type because expression of type '"Portugal"' can't be used to index type '{}'.
  Property 'Portugal' does not exist on type '{}'.

Here an object with undefined keys is used. Which is a violation of typscript. Cant use this for typed backend/frontend communication,

maxrohleder commented 3 years ago

Using {} as type is forbidden in typescript. Everthing is a type like that so it does not make sense to type it at all.

Screenshot 2020-12-13 at 16 11 39