New typings: japan-postal-code (#42700)

* clear to tests

* Clear to tests

* Failing tests fix

* fix failing tests

* fix failing tests

* fix failing tests
This commit is contained in:
TokugawaT_YD
2020-02-28 10:24:50 -08:00
committed by GitHub
parent 6e00d264a9
commit 19950d0f4e
4 changed files with 65 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
// Type definitions for japan-postal-code 0.2
// Project: https://github.com/mzp/japan-postal-code
// Definitions by: Takesi Tokugawa <https://github.com/TokugawaTakesi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace JapanPostalCodeLibrary;
export = JapanPostalCode;
declare const JapanPostalCode: JapanPostalCode.API;
declare namespace JapanPostalCode {
interface API {
get: FetchPostalCodeMethod;
}
interface FetchPostalCodeMethod {
(stringifiedPostalCode: string, callback: Callback): void;
}
interface Callback {
(addressData: AddressData): void;
}
interface AddressData {
prefecture: string;
city: string;
area: string;
street: string;
}
}
@@ -0,0 +1,8 @@
import JapanPostalCode from "japan-postal-code";
JapanPostalCode.get('1000001', (addressData: JapanPostalCode.AddressData) => {
console.log(addressData.prefecture);
console.log(addressData.city);
console.log(addressData.area);
console.log(addressData.street);
});
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"esModuleInterop": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"japan-postal-code-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }