From 159f334e789a7d9f692d4e17480c742d5413da50 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Thu, 24 Feb 2022 20:56:36 +0100 Subject: [PATCH] Typescript --- .../ProcessInputForm/classProcessInputForm.ts | 5 ++--- scripts/types/typeDefinitions.ts | 17 ++++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/scripts/classes/ProcessInputForm/classProcessInputForm.ts b/scripts/classes/ProcessInputForm/classProcessInputForm.ts index c852a75..610254a 100644 --- a/scripts/classes/ProcessInputForm/classProcessInputForm.ts +++ b/scripts/classes/ProcessInputForm/classProcessInputForm.ts @@ -4,15 +4,14 @@ import classShowHideElements from "./classShowHideElements"; import classErrorHandler from "../ErrorHandler/classErrorHandler"; // Type definition imports -import { TStatensVegvesenBilData } from "../../types/typeDefinitions"; +import { IStatensVegvesenBilData } from "../../types/typeDefinitions"; /** * Class responsible for fetching the remote data * @property {TStatensVegvesenBilData} remoteBilData Remote data from API */ export default class classProcessInputForm { - //private static remoteBilData: TStatensVegvesenBilData; - private static remoteBilData: any; + private static remoteBilData: IStatensVegvesenBilData; /** * Send the form, show the loading spinner and fetch remote data diff --git a/scripts/types/typeDefinitions.ts b/scripts/types/typeDefinitions.ts index bc36553..910cb1f 100644 --- a/scripts/types/typeDefinitions.ts +++ b/scripts/types/typeDefinitions.ts @@ -2,7 +2,8 @@ * Type definition for data returned from API. * Returns an object with strings. */ -export type TStatensVegvesenBilData = { + +export interface IStatensVegvesenBilData { // Will return error message if the car was not found melding: string; /** @@ -10,12 +11,10 @@ export type TStatensVegvesenBilData = { * @see https://www.vegvesen.no/en/vehicles/own-and-maintain/number-plates/personalised-number-plates */ kjennemerke: string; - registrering: { - // Details about when car was registered for the first time - forstegangsregistrering: string; - // Details about when car was registered on owner - forstegangsregistreringEier: string; - }; + // Details about when car was registered for the first time + forstegangsregistrering: string; + // Details about when car was registered on owner + forstegangsregistreringEier: string; // Last time the car had a mandatory roadworthiness test - periodiskKjoretoykontroll: { sistKontrollert: string }; -}; + sistKontrollert: string; +}