From 5753991d41241bd76274767b05a4cf4d6451dba7 Mon Sep 17 00:00:00 2001 From: Matt Fedderly Date: Thu, 7 Dec 2017 12:09:53 -0500 Subject: [PATCH] add typescript type definitions --- index.d.ts | 20 ++++++++++++++++++++ package.json | 1 + 2 files changed, 21 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..021211f --- /dev/null +++ b/index.d.ts @@ -0,0 +1,20 @@ +declare module "iso-639-1" { + interface ISO6391 { + getName: (code: string) => string; + getAllNames: () => Array; + getNativeName: (code: string) => string; + getAllNativeNames: () => Array; + getCode: (name: string) => string; + getAllCodes: () => Array; + validate: (code: string) => boolean; + getLanguages: (codes: Array) => Array<{ + code: string; + name: string; + nativeName: string; + }>; + } + + let localeCode: ISO6391; + + export = localeCode; +} diff --git a/package.json b/package.json index 8e2d6f9..fd2949c 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "2.0.1", "description": "ISO-639-1 codes", "main": "build/index.js", + "typings": "index.d.ts", "scripts": { "build": "babel src --out-dir build", "test": "mocha"