-
Notifications
You must be signed in to change notification settings - Fork 837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add typescript definitions #444
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a19891c
add typescript definitions
bmagistro 1e3549d
correct indentation to be consistent
bmagistro 404be18
typing test, like definitions pulled from DefinitelyTyped
bmagistro 0b2e7d6
add dev dependencies
bmagistro 5b312b3
update node version based on other modules' dependencies
bmagistro 464339c
Merge branch 'develop' into develop
bmagistro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Type definitions for moment-timezone.js 0.2 | ||
// Project: http://momentjs.com/timezone/ | ||
// Definitions by: Michel Salib <https://github.com/michelsalib> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
/// <reference path="../moment/moment.d.ts" /> | ||
|
||
declare namespace moment { | ||
interface MomentBuiltinFormat { | ||
__momentBuiltinFormatBrand: any; | ||
} | ||
|
||
type MomentFormatSpecification = string | MomentBuiltinFormat | (string | MomentBuiltinFormat)[]; | ||
|
||
interface Moment { | ||
tz(): string; | ||
tz(timezone: string): Moment; | ||
zoneAbbr(): string; | ||
zoneName(): string; | ||
} | ||
|
||
interface MomentZone { | ||
name: string; | ||
abbrs: string[]; | ||
untils: number[]; | ||
offsets: number[]; | ||
|
||
abbr(timestamp: number): string; | ||
offset(timestamp: number): number; | ||
parse(timestamp: number): number; | ||
} | ||
|
||
interface MomentTimezone { | ||
(): moment.Moment; | ||
(timezone: string): moment.Moment; | ||
(date: number, timezone: string): moment.Moment; | ||
(date: number[], timezone: string): moment.Moment; | ||
(date: string, timezone: string): moment.Moment; | ||
(date: string, format: moment.MomentFormatSpecification, timezone: string): moment.Moment; | ||
(date: string, format: moment.MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment; | ||
(date: string, format: moment.MomentFormatSpecification, language: string, timezone: string): moment.Moment; | ||
(date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment; | ||
(date: Date, timezone: string): moment.Moment; | ||
(date: moment.Moment, timezone: string): moment.Moment; | ||
(date: any, timezone: string): moment.Moment; | ||
|
||
zone(timezone: string): MomentZone; | ||
|
||
add(packedZoneString: string): void; | ||
add(packedZoneString: string[]): void; | ||
|
||
link(packedLinkString: string): void; | ||
link(packedLinkString: string[]): void; | ||
|
||
load(data: { | ||
version: string; | ||
links: string[]; | ||
zones: string[]; | ||
}): void; | ||
|
||
names(): string[]; | ||
guess(): string; | ||
|
||
setDefault(timezone: string): void; | ||
} | ||
|
||
const tz: MomentTimezone; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the inconsistent indentation intentional? (This and above vs. the interfaces below.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was not intentional. Haven't done much with JS. I used the initial from DefinitelyTyped and referenced other typescript files to get to this one. If there is a preferred format, I can make the updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the file is indented correctly--just be consistent.