From 46c5cdc2c2cfbd5663520f70ed221f217b07e35d Mon Sep 17 00:00:00 2001 From: Logan Dam Date: Mon, 14 Jan 2019 17:40:45 +0200 Subject: [PATCH] made things readonly --- types/country-data/country-data-tests.ts | 20 ++-- types/country-data/index.d.ts | 120 +++++++++++------------ 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/types/country-data/country-data-tests.ts b/types/country-data/country-data-tests.ts index e3b1ba663d..850116dc63 100644 --- a/types/country-data/country-data-tests.ts +++ b/types/country-data/country-data-tests.ts @@ -1,14 +1,14 @@ import * as lib from 'country-data'; -lib.callingCodes.all; // $ExpectType string[] -lib.callingCountries.all; // $ExpectType Country[] +lib.callingCodes.all; // $ExpectType ReadonlyArray +lib.callingCountries.all; // $ExpectType ReadonlyArray lib.continents.africa; // $ExpectType Continent -lib.continents.africa.countries; // $ExpectType Country[] -lib.countries.all; // $ExpectType Country[] -lib.currencies.all; // $ExpectType Currency[] -lib.languages.all; // $ExpectType Language[] +lib.continents.africa.countries; // $ExpectType ReadonlyArray +lib.countries.all; // $ExpectType ReadonlyArray +lib.currencies.all; // $ExpectType ReadonlyArray +lib.languages.all; // $ExpectType ReadonlyArray lib.regions.antarctica; // $ExpectType Region -lib.regions.antarctica.countries; // $ExpectType string[] -lib.lookup.countries(""); // $ExpectType Country[] -lib.lookup.currencies(""); // $ExpectType Currency[] -lib.lookup.languages(""); // $ExpectType Language[] +lib.regions.antarctica.countries; // $ExpectType ReadonlyArray +lib.lookup.countries(""); // $ExpectType ReadonlyArray +lib.lookup.currencies(""); // $ExpectType ReadonlyArray +lib.lookup.languages(""); // $ExpectType ReadonlyArray diff --git a/types/country-data/index.d.ts b/types/country-data/index.d.ts index 4d97e3dc98..80acbbcbba 100644 --- a/types/country-data/index.d.ts +++ b/types/country-data/index.d.ts @@ -4,100 +4,100 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface Country { - alpha2: string; - alpha3: string; - countryCallingCodes: string[]; - currencies: string[]; - emoji: string; - ioc: string; - languages: string[]; - name: string; - status: string; + readonly alpha2: string; + readonly alpha3: string; + readonly countryCallingCodes: ReadonlyArray; + readonly currencies: ReadonlyArray; + readonly emoji: string; + readonly ioc: string; + readonly languages: ReadonlyArray; + readonly name: string; + readonly status: string; } export interface Currency { - code: string; - decimals: number; - name: string; - number: number; + readonly code: string; + readonly decimals: number; + readonly name: string; + readonly number: number; } export interface Language { - alpha2: string; - alpha3: string; - bibliographic: string; - name: string; + readonly alpha2: string; + readonly alpha3: string; + readonly bibliographic: string; + readonly name: string; } export interface Continent { - name: string; - regions: string[]; - countries: Country[]; + readonly name: string; + readonly regions: ReadonlyArray; + readonly countries: ReadonlyArray; } export interface Region { - name: string; - countries: string[]; + readonly name: string; + readonly countries: ReadonlyArray; } export const countries: { - all: Country[]; + readonly all: ReadonlyArray; }; export const continents: { - africa: Continent; - antarctica: Continent; - asia: Continent; - europe: Continent; - northAmerica: Continent; - oceania: Continent; - southAmerica: Continent; + readonly africa: Continent; + readonly antarctica: Continent; + readonly asia: Continent; + readonly europe: Continent; + readonly northAmerica: Continent; + readonly oceania: Continent; + readonly southAmerica: Continent; }; export const callingCodes: { - all: string[]; + readonly all: ReadonlyArray; }; export const callingCountries: { - all: Country[]; + readonly all: ReadonlyArray; }; export const currencies: { - all: Currency[]; + readonly all: ReadonlyArray; }; export const languages: { - all: Language[]; + readonly all: ReadonlyArray; }; export const regions: { - centralAsia: Region; - southernAsia: Region; - southeastAsia: Region; - eastAsia: Region; - westernAsia: Region; - centralAfrica: Region; - northAfrica: Region; - southernAfrica: Region; - eastAfrica: Region; - westAfrica: Region; - centralAmerica: Region; - northernAmerica: Region; - caribbean: Region; - southAmerica: Region; - antarctica: Region; - northernEurope: Region; - southernEurope: Region; - easternEurope: Region; - westernEurope: Region; - australia: Region; - melanesia: Region; - micronesia: Region; - polynesia: Region; + readonly centralAsia: Region; + readonly southernAsia: Region; + readonly southeastAsia: Region; + readonly eastAsia: Region; + readonly westernAsia: Region; + readonly centralAfrica: Region; + readonly northAfrica: Region; + readonly southernAfrica: Region; + readonly eastAfrica: Region; + readonly westAfrica: Region; + readonly centralAmerica: Region; + readonly northernAmerica: Region; + readonly caribbean: Region; + readonly southAmerica: Region; + readonly antarctica: Region; + readonly northernEurope: Region; + readonly southernEurope: Region; + readonly easternEurope: Region; + readonly westernEurope: Region; + readonly australia: Region; + readonly melanesia: Region; + readonly micronesia: Region; + readonly polynesia: Region; }; export const lookup: { - countries: (query: any) => Country[]; - currencies: (query: any) => Currency[]; - languages: (query: any) => Language[]; + readonly countries: (query: any) => ReadonlyArray; + readonly currencies: (query: any) => ReadonlyArray; + readonly languages: (query: any) => ReadonlyArray; };