Merge pull request #14605 from syamatoo/master

Add definitions for japanese-holidays
This commit is contained in:
Zhengbo Li
2017-02-14 13:10:36 -08:00
committed by GitHub
4 changed files with 57 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
// Type definitions for japanese-holidays 1.0
// Project: https://github.com/osamutake/japanese-holidays-js
// Definitions by: syamatoo <https://github.com/syamatoo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function isHoliday(date: Date, furikae?: boolean): string | undefined;
export function isHolidayAt(date: Date, furikae?: boolean): string | undefined;
export function getHolidaysOf(year: number, furikae?: boolean): Holiday[];
export interface Holiday {
month: number;
date: number;
name: string;
}
@@ -0,0 +1,22 @@
import {isHoliday, isHolidayAt, getHolidaysOf} from 'japanese-holidays'
const date = new Date(2017, 0, 9)
const h: string | undefined = isHoliday(date)
if (h != undefined) {
h.charAt(0)
}
const noFurikae: string | undefined = isHoliday(date, false)
const hAt = isHolidayAt(date)
if (hAt != undefined) {
hAt.charAt(0)
}
isHolidayAt(date, false)
const holidays = getHolidaysOf(2017)
const first = holidays[0]
const n: string = first.name
const m: number = first.month
const d: number = first.date
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"japanese-holidays-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }