From 186c2231e4d2e8b6787ad02eeb97e908684b2f39 Mon Sep 17 00:00:00 2001 From: fershad <27988517+fershad@users.noreply.github.com> Date: Mon, 8 Jan 2024 11:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#67910=20Add=20type?= =?UTF-8?q?s=20for=20@tgwf/co2=20by=20@fershad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add types for @tgwf/co2 * update exports * update exports * ran formatting * add Chris Adams as owner * format package.json * remove "paths" from tsconfig * use export = * export intensity data as namespace * change imports * export class * explicit export * use body of namespace as module * fix file paths * remove file paths * correct paths * fix no exported member error * correct missing name * use requires for imports * export declarations * replace export with declare --- types/tgwf__co2/.npmignore | 5 + types/tgwf__co2/1byte.d.ts | 14 ++ types/tgwf__co2/co2.d.ts | 145 +++++++++++ .../data/average-intensities.min.d.ts | 227 +++++++++++++++++ .../data/marginal-intensities-2021.min.d.ts | 238 ++++++++++++++++++ types/tgwf__co2/hosting.d.ts | 6 + types/tgwf__co2/index.d.ts | 14 ++ types/tgwf__co2/package.json | 21 ++ types/tgwf__co2/sustainable-web-design.d.ts | 94 +++++++ types/tgwf__co2/tgwf__co2-tests.test.ts | 19 ++ types/tgwf__co2/tgwf__co2-tests.ts | 28 +++ types/tgwf__co2/tsconfig.json | 19 ++ 12 files changed, 830 insertions(+) create mode 100644 types/tgwf__co2/.npmignore create mode 100644 types/tgwf__co2/1byte.d.ts create mode 100644 types/tgwf__co2/co2.d.ts create mode 100644 types/tgwf__co2/data/average-intensities.min.d.ts create mode 100644 types/tgwf__co2/data/marginal-intensities-2021.min.d.ts create mode 100644 types/tgwf__co2/hosting.d.ts create mode 100644 types/tgwf__co2/index.d.ts create mode 100644 types/tgwf__co2/package.json create mode 100644 types/tgwf__co2/sustainable-web-design.d.ts create mode 100644 types/tgwf__co2/tgwf__co2-tests.test.ts create mode 100644 types/tgwf__co2/tgwf__co2-tests.ts create mode 100644 types/tgwf__co2/tsconfig.json diff --git a/types/tgwf__co2/.npmignore b/types/tgwf__co2/.npmignore new file mode 100644 index 00000000000000..93e307400a5456 --- /dev/null +++ b/types/tgwf__co2/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts diff --git a/types/tgwf__co2/1byte.d.ts b/types/tgwf__co2/1byte.d.ts new file mode 100644 index 00000000000000..b80c83f6c90092 --- /dev/null +++ b/types/tgwf__co2/1byte.d.ts @@ -0,0 +1,14 @@ +declare class OneByte { + constructor(options: any); + options: any; + KWH_PER_BYTE_FOR_NETWORK: number; + /** + * Calculates the carbon footprint of a website using the OneByte model + * @param {number} bytes - The number of bytes to calculate the carbon footprint for + * @param {boolean} green - Whether the energy is green or not + * @returns {number} The carbon footprint in grams of CO2 + */ + perByte(bytes: number, green: boolean): number; +} + +export = OneByte; diff --git a/types/tgwf__co2/co2.d.ts b/types/tgwf__co2/co2.d.ts new file mode 100644 index 00000000000000..52828edc0a3db6 --- /dev/null +++ b/types/tgwf__co2/co2.d.ts @@ -0,0 +1,145 @@ +import OneByte = require("./1byte.js"); +import SustainableWebDesign = require("./sustainable-web-design.js"); +interface CO2EstimateTraceResultPerByte { + /** + * - The CO2 estimate in grams/kilowatt-hour + */ + co2: number; + /** + * - Whether the domain is green or not + */ + green: boolean; + /** + * - The variables used to calculate the CO2 estimate + */ + variables: TraceResultVariablesPerByte; +} +interface CO2EstimateTraceResultPerVisit { + /** + * - The CO2 estimate in grams/kilowatt-hour + */ + co2: number; + /** + * - Whether the domain is green or not + */ + green: boolean; + /** + * - The variables used to calculate the CO2 estimate + */ + variables: TraceResultVariablesPerVisit; +} +interface TraceResultVariablesPerByte { + /** + * - The grid intensity related variables + */ + gridIntensity: GridIntensityVariables; +} +interface TraceResultVariablesPerVisit { + /** + * - The grid intensity related variables + */ + gridIntensity: GridIntensityVariables; + /** + * - What percentage of a page is reloaded on each subsequent page view + */ + dataReloadRatio: number; + /** + * - What percentage of visits are loading this page for subsequent times + */ + firstVisitPercentage: number; + /** + * - What percentage of visits are loading this page for the second or more time + */ + returnVisitPercentage: number; +} +interface GridIntensityVariables { + /** + * - The description of the variables + */ + description: string; + /** + * - The network grid intensity set by the user or the default + */ + network: number; + /** + * - The data center grid intensity set by the user or the default + */ + dataCenter: number; + /** + * - The device grid intensity set by the user or the default + */ + device: number; + /** + * - The production grid intensity set by the user or the default + */ + production: number; +} +declare class CO2 { + constructor(options: any); + model: OneByte | SustainableWebDesign; + private _segment; + /** + * Accept a figure in bytes for data transfer, and a boolean for whether + * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding + * the data transfer. + * + * @param {number} bytes + * @param {boolean} green + * @return {number} the amount of CO2 in grammes + */ + perByte(bytes: number, green?: boolean): number; + /** + * Accept a figure in bytes for data transfer, and a boolean for whether + * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding + * the data transfer. + * + * @param {number} bytes + * @param {boolean} green + * @return {number} the amount of CO2 in grammes + */ + perVisit(bytes: number, green?: boolean): number; + /** + * Accept a figure in bytes for data transfer, a boolean for whether + * the domain shows as 'green', and an options object. + * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure. + * + * @param {number} bytes + * @param {boolean} green + * @param {Object} options + * @return {CO2EstimateTraceResultPerByte} the amount of CO2 in grammes + */ + perByteTrace(bytes: number, green?: boolean, options?: any): CO2EstimateTraceResultPerByte; + /** + * Accept a figure in bytes for data transfer, a boolean for whether + * the domain shows as 'green', and an options object. + * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure. + * + * @param {number} bytes + * @param {boolean} green + * @param {Object} options + * @return {CO2EstimateTraceResultPerVisit} the amount of CO2 in grammes + */ + perVisitTrace(bytes: number, green?: boolean, options?: any): CO2EstimateTraceResultPerVisit; + perDomain(pageXray: any, greenDomains: any): Array<{ + domain: string; + co2: number; + transferSize: any; + }>; + perPage(pageXray: any, green: any): number; + perContentType(pageXray: any, greenDomains: any): Array<{ + type: string; + co2: any; + transferSize: any; + }>; + dirtiestResources(pageXray: any, greenDomains: any): Array<{ + url: any; + co2: number; + transferSize: any; + }>; + perParty(pageXray: any, greenDomains: any): { + firstParty: number; + thirdParty: number; + }; +} + +export = CO2; diff --git a/types/tgwf__co2/data/average-intensities.min.d.ts b/types/tgwf__co2/data/average-intensities.min.d.ts new file mode 100644 index 00000000000000..17450116260c36 --- /dev/null +++ b/types/tgwf__co2/data/average-intensities.min.d.ts @@ -0,0 +1,227 @@ +export const data: { + AFG: number; + AFRICA: number; + ALB: number; + DZA: number; + ASM: number; + AGO: number; + ATG: number; + ARG: number; + ARM: number; + ABW: number; + ASEAN: number; + ASIA: number; + AUS: number; + AUT: number; + AZE: number; + BHS: number; + BHR: number; + BGD: number; + BRB: number; + BLR: number; + BEL: number; + BLZ: number; + BEN: number; + BTN: number; + BOL: number; + BIH: number; + BWA: number; + BRA: number; + BRN: number; + BGR: number; + BFA: number; + BDI: number; + CPV: number; + KHM: number; + CMR: number; + CAN: number; + CYM: number; + CAF: number; + TCD: number; + CHL: number; + CHN: number; + COL: number; + COM: number; + COG: number; + COD: number; + COK: number; + CRI: number; + CIV: number; + HRV: number; + CUB: number; + CYP: number; + CZE: number; + DNK: number; + DJI: number; + DMA: number; + DOM: number; + ECU: number; + EGY: number; + SLV: number; + GNQ: number; + ERI: number; + EST: number; + SWZ: number; + ETH: number; + EU: number; + EUROPE: number; + FLK: number; + FRO: number; + FJI: number; + FIN: number; + FRA: number; + GUF: number; + PYF: number; + G20: number; + G7: number; + GAB: number; + GMB: number; + GEO: number; + DEU: number; + GHA: number; + GRC: number; + GRL: number; + GRD: number; + GLP: number; + GUM: number; + GTM: number; + GIN: number; + GNB: number; + GUY: number; + HTI: number; + HND: number; + HKG: number; + HUN: number; + ISL: number; + IND: number; + IDN: number; + IRN: number; + IRQ: number; + IRL: number; + ISR: number; + ITA: number; + JAM: number; + JPN: number; + JOR: number; + KAZ: number; + KEN: number; + KIR: number; + XKX: number; + KWT: number; + KGZ: number; + LAO: number; + "LATIN AMERICA AND CARIBBEAN": number; + LVA: number; + LBN: number; + LSO: number; + LBR: number; + LBY: number; + LTU: number; + LUX: number; + MAC: number; + MDG: number; + MWI: number; + MYS: number; + MDV: number; + MLI: number; + MLT: number; + MTQ: number; + MRT: number; + MUS: number; + MEX: number; + "MIDDLE EAST": number; + MDA: number; + MNG: number; + MNE: number; + MSR: number; + MAR: number; + MOZ: number; + MMR: number; + NAM: number; + NRU: number; + NPL: number; + NLD: number; + NCL: number; + NZL: number; + NIC: number; + NER: number; + NGA: number; + "NORTH AMERICA": number; + PRK: number; + MKD: number; + NOR: number; + OCEANIA: number; + OECD: number; + OMN: number; + PAK: number; + PSE: number; + PAN: number; + PNG: number; + PRY: number; + PER: number; + POL: number; + PRT: number; + PRI: number; + QAT: number; + REU: number; + ROU: number; + RUS: number; + RWA: number; + KNA: number; + LCA: number; + SPM: number; + VCT: number; + WSM: number; + STP: number; + SAU: number; + SEN: number; + SRB: number; + SYC: number; + SLE: number; + SGP: number; + SVK: number; + SVN: number; + SLB: number; + SOM: number; + ZAF: number; + KOR: number; + SSD: number; + ESP: number; + LKA: number; + SDN: number; + SUR: number; + SWE: number; + CHE: number; + SYR: number; + TWN: number; + TJK: number; + TZA: number; + THA: number; + PHL: number; + TGO: number; + TON: number; + TTO: number; + TUN: number; + TUR: number; + TKM: number; + TCA: number; + UGA: number; + UKR: number; + ARE: number; + GBR: number; + USA: number; + URY: number; + UZB: number; + VUT: number; + VEN: number; + VNM: number; + VGB: number; + VIR: number; + WORLD: number; + YEM: number; + ZMB: number; + ZWE: number; +}; +export const type: "average"; + +export as namespace averageIntensity; diff --git a/types/tgwf__co2/data/marginal-intensities-2021.min.d.ts b/types/tgwf__co2/data/marginal-intensities-2021.min.d.ts new file mode 100644 index 00000000000000..de85b4e979f9b3 --- /dev/null +++ b/types/tgwf__co2/data/marginal-intensities-2021.min.d.ts @@ -0,0 +1,238 @@ +export const data: { + AFG: string; + ALB: string; + DZA: string; + ASM: string; + AND: string; + AGO: string; + AIA: string; + ATG: string; + ARG: string; + ARM: string; + ABW: string; + AUS: string; + AUT: string; + AZE: string; + "AZORES (PORTUGAL)": string; + BHS: string; + BHR: string; + BGD: string; + BRB: string; + BLR: string; + BEL: string; + BLZ: string; + BEN: string; + BMU: string; + BTN: string; + BOL: string; + BES: string; + BIH: string; + BWA: string; + BRA: string; + VGB: string; + BRN: string; + BGR: string; + BFA: string; + BDI: string; + KHM: string; + CMR: string; + CAN: string; + CYM: string; + CPV: string; + CAF: string; + TCD: string; + "CHANNEL ISLANDS (U.K)": string; + CHL: string; + CHN: string; + COL: string; + COM: string; + COD: string; + COG: string; + COK: string; + CRI: string; + CIV: string; + HRV: string; + CUB: string; + CUW: string; + CYP: string; + CZE: string; + DNK: string; + DJI: string; + DMA: string; + DOM: string; + ECU: string; + EGY: string; + SLV: string; + GNQ: string; + ERI: string; + EST: string; + SWZ: string; + ETH: string; + FLK: string; + FRO: string; + FJI: string; + FIN: string; + FRA: string; + GUF: string; + PYF: string; + GAB: string; + GMB: string; + GEO: string; + DEU: string; + GHA: string; + GIB: string; + GRC: string; + GRL: string; + GRD: string; + GLP: string; + GUM: string; + GTM: string; + GIN: string; + GNB: string; + GUY: string; + HTI: string; + HND: string; + HUN: string; + ISL: string; + IND: string; + IDN: string; + IRN: string; + IRQ: string; + IRL: string; + IMN: string; + ISR: string; + ITA: string; + JAM: string; + JPN: string; + JOR: string; + KAZ: string; + KEN: string; + KIR: string; + PRK: string; + KOR: string; + XKX: string; + KWT: string; + KGZ: string; + LAO: string; + LVA: string; + LBN: string; + LSO: string; + LBR: string; + LBY: string; + LIE: string; + LTU: string; + LUX: string; + MDG: string; + "MADEIRA (PORTUGAL)": string; + MWI: string; + MYS: string; + MDV: string; + MLI: string; + MLT: string; + MHL: string; + MTQ: string; + MRT: string; + MUS: string; + MYT: string; + MEX: string; + FSM: string; + MDA: string; + MCO: string; + MNG: string; + MNE: string; + MSR: string; + MAR: string; + MOZ: string; + MMR: string; + NAM: string; + NRU: string; + NPL: string; + NLD: string; + NCL: string; + NZL: string; + NIC: string; + NER: string; + NGA: string; + NIU: string; + MKD: string; + MNP: string; + NOR: string; + OMN: string; + PAK: string; + PLW: string; + PSE: string; + PAN: string; + PNG: string; + PRY: string; + PER: string; + PHL: string; + POL: string; + PRT: string; + PRI: string; + QAT: string; + REU: string; + ROU: string; + RUS: string; + RWA: string; + SHN: string; + KNA: string; + LCA: string; + MAF: string; + SPM: string; + VCT: string; + WSM: string; + SMR: string; + STP: string; + SAU: string; + SEN: string; + SRB: string; + SYC: string; + SLE: string; + SGP: string; + SXM: string; + SVK: string; + SVN: string; + SLB: string; + SOM: string; + ZAF: string; + SSD: string; + ESP: string; + LKA: string; + SDN: string; + SUR: string; + SWE: string; + CHE: string; + SYR: string; + TWN: string; + TJK: string; + TZA: string; + THA: string; + TLS: string; + TGO: string; + TON: string; + TTO: string; + TUN: string; + TUR: string; + TKM: string; + TCA: string; + TUV: string; + UGA: string; + UKR: string; + ARE: string; + GBR: string; + USA: string; + URY: string; + UZB: string; + VUT: string; + VEN: string; + VNM: string; + VIR: string; + YEM: string; + ZMB: string; + ZWE: string; + "MEMO: EU 27": string; +}; +export const type: "marginal"; +export const year: "2021"; + +export as namespace marginalIntensity; diff --git a/types/tgwf__co2/hosting.d.ts b/types/tgwf__co2/hosting.d.ts new file mode 100644 index 00000000000000..263b6978229d3d --- /dev/null +++ b/types/tgwf__co2/hosting.d.ts @@ -0,0 +1,6 @@ +/** + * Check if a domain is hosted by a green web host. + * @param {string|array} domain - The domain to check, or an array of domains to be checked. + * @returns {boolean|array} - A boolean if a string was provided, or an array of booleans if an array of domains was provided. + */ +export function check(domain: string | any[]): boolean | any[]; diff --git a/types/tgwf__co2/index.d.ts b/types/tgwf__co2/index.d.ts new file mode 100644 index 00000000000000..8e66984586b419 --- /dev/null +++ b/types/tgwf__co2/index.d.ts @@ -0,0 +1,14 @@ + +import co2 = require("./co2"); +import averageIntensity = require("./data/average-intensities.min"); +import marginalIntensity = require("./data/marginal-intensities-2021.min"); +import hosting = require("./hosting"); + +export { co2, hosting, averageIntensity, marginalIntensity }; + +export namespace co2js { + export { co2 }; + export { hosting }; + export { averageIntensity }; + export { marginalIntensity }; +} diff --git a/types/tgwf__co2/package.json b/types/tgwf__co2/package.json new file mode 100644 index 00000000000000..41117665afc402 --- /dev/null +++ b/types/tgwf__co2/package.json @@ -0,0 +1,21 @@ +{ + "private": true, + "name": "@types/tgwf__co2", + "version": "0.0.9999", + "projects": [ + "https://github.com/thegreenwebfoundation/co2.js" + ], + "devDependencies": { + "@types/tgwf__co2": "workspace:." + }, + "owners": [ + { + "name": "Fershad Irani", + "githubUsername": "fershad" + }, + { + "name": "Chris Adams", + "githubUsername": "mrchrisadams" + } + ] +} diff --git a/types/tgwf__co2/sustainable-web-design.d.ts b/types/tgwf__co2/sustainable-web-design.d.ts new file mode 100644 index 00000000000000..7284fe7ada24fc --- /dev/null +++ b/types/tgwf__co2/sustainable-web-design.d.ts @@ -0,0 +1,94 @@ +declare class SustainableWebDesign { + constructor(options: any); + options: any; + /** + * Accept a figure for bytes transferred and return an object representing + * the share of the total enrgy use of the entire system, broken down + * by each corresponding system component + * + * @param {number} bytes - the data transferred in bytes + * @return {object} Object containing the energy in kilowatt hours, keyed by system component + */ + energyPerByteByComponent(bytes: number): object; + /** + * Accept an object keys by the different system components, and + * return an object with the co2 figures key by the each component + * + * @param {object} energyByComponent - energy grouped by the four system components + * @param {number} [carbonIntensity] - carbon intensity to apply to the datacentre values + * @return {number} the total number in grams of CO2 equivalent emissions + */ + co2byComponent(energyByComponent: object, carbonIntensity?: number, options?: {}): number; + /** + * Accept a figure for bytes transferred and return a single figure for CO2 + * emissions. Where information exists about the origin data is being + * fetched from, a different carbon intensity figure + * is applied for the data centre share of the carbon intensity. + * + * @param {number} bytes - the data transferred in bytes + * @param {boolean} carbonIntensity - a boolean indicating whether the data center is green or not + * @param {boolean} segmentResults - a boolean indicating whether to return the results broken down by component + * @param {object} options - an object containing the grid intensity and first/return visitor values + * @return {number|object} the total number in grams of CO2 equivalent emissions, or an object containing the breakdown by component + */ + perByte(bytes: number, carbonIntensity?: boolean, segmentResults?: boolean, options?: object): number | object; + /** + * Accept a figure for bytes transferred and return a single figure for CO2 + * emissions. This method applies caching assumptions from the original Sustainable Web Design model. + * + * @param {number} bytes - the data transferred in bytes + * @param {boolean} carbonIntensity - a boolean indicating whether the data center is green or not + * @param {boolean} segmentResults - a boolean indicating whether to return the results broken down by component + * @param {object} options - an object containing the grid intensity and first/return visitor values + * @return {number|object} the total number in grams of CO2 equivalent emissions, or an object containing the breakdown by component + */ + perVisit(bytes: number, carbonIntensity?: boolean, segmentResults?: boolean, options?: object): number | object; + /** + * Accept a figure for bytes transferred and return the number of kilowatt hours used + * by the total system for this data transfer + * + * @param {number} bytes + * @return {number} the number of kilowatt hours used + */ + energyPerByte(bytes: number): number; + /** + * Accept a figure for bytes transferred, and return an object containing figures + * per system component, with the caching assumptions applied. This tries to account + * for webpages being loaded from a cache by browsers, so if you had a thousand page views, + * and tried to work out the energy per visit, the numbers would reflect the reduced amounts + * of transfer. + * + * @param {number} bytes - the data transferred in bytes for loading a webpage + * @param {number} firstView - what percentage of visits are loading this page for the first time + * @param {number} returnView - what percentage of visits are loading this page for subsequent times + * @param {number} dataReloadRatio - what percentage of a page is reloaded on each subsequent page view + * + * @return {object} Object containing the energy in kilowatt hours, keyed by system component + */ + energyPerVisitByComponent( + bytes: number, + options?: {}, + firstView?: number, + returnView?: number, + dataReloadRatio?: number, + ): object; + /** + * Accept a figure for bytes, and return the total figure for energy per visit + * using the default caching assumptions for loading a single website + * + * @param {number} bytes + * @return {number} the total energy use for the visit, after applying the caching assumptions + */ + energyPerVisit(bytes: number): number; + emissionsPerVisitInGrams(energyPerVisit: any, carbonintensity?: number): number; + annualEnergyInKwh(energyPerVisit: any, monthlyVisitors?: number): number; + annualEmissionsInGrams(co2grams: any, monthlyVisitors?: number): number; + annualSegmentEnergy(annualEnergy: any): { + consumerDeviceEnergy: number; + networkEnergy: number; + dataCenterEnergy: number; + productionEnergy: number; + }; +} + +export = SustainableWebDesign; diff --git a/types/tgwf__co2/tgwf__co2-tests.test.ts b/types/tgwf__co2/tgwf__co2-tests.test.ts new file mode 100644 index 00000000000000..8c468225c2f110 --- /dev/null +++ b/types/tgwf__co2/tgwf__co2-tests.test.ts @@ -0,0 +1,19 @@ +import { averageIntensity, marginalIntensity } from "@tgwf/co2"; + +// Test the data object for average intensity +const averageData: { [key: string]: number } = averageIntensity.data; + +// Test the value for a country for average intensity +const ausAverage: number = averageIntensity.data.AUS; + +// Test the type for average intensity +const averageType: string = averageIntensity.type; + +// Test the data object for marginal intensity +const marginalData: { [key: string]: number } = marginalIntensity.data; + +// Test the value for a country for marginal intensity +const ausMarginal: number = marginalIntensity.data.AUS; + +// Test the type for marginal intensity +const marginalType: string = marginalIntensity.type; diff --git a/types/tgwf__co2/tgwf__co2-tests.ts b/types/tgwf__co2/tgwf__co2-tests.ts new file mode 100644 index 00000000000000..f34e9fe0ebe978 --- /dev/null +++ b/types/tgwf__co2/tgwf__co2-tests.ts @@ -0,0 +1,28 @@ +import { averageIntensity, co2, hosting, marginalIntensity } from "@tgwf/co2"; + +const averageData = averageIntensity.data; +const averageAus = averageIntensity.data.AUS; +const averageType = averageIntensity.type; + +const marginalData = marginalIntensity.data; +const marginalAus = marginalIntensity.data.AUS; +const marginalType = marginalIntensity.type; +const marginalYear = marginalIntensity.year; + +// Test the OneByte class +const oneByte = new co2({ model: "1byte" }); +const oneByteCO2PerByte = oneByte.perByte(1000, true); + +// Test the SWD class +const swd = new co2({ model: "swd" }); +const swdCO2PerByte = swd.perByte(1000, true); +const swdCO2PerVisit = swd.perVisit(1000, true); + +// Test the SWD class with segment results +const swdSegment = new co2({ model: "swd", results: "segment" }); +const swdSegmentCO2PerByte = swdSegment.perByte(1000, true); +const swdSegmentCO2PerVisit = swdSegment.perVisit(1000, true); + +// Test green hosting check using API +const googleCheck = hosting.check("google.com"); +const arrayCheck = hosting.check(["google.com", "facebook.com"]); diff --git a/types/tgwf__co2/tsconfig.json b/types/tgwf__co2/tsconfig.json new file mode 100644 index 00000000000000..5651a23bee0a4a --- /dev/null +++ b/types/tgwf__co2/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "tgwf__co2-tests.ts" + ] +}