Skip to content

Commit

Permalink
fix: Correct TypeScript types
Browse files Browse the repository at this point in the history
  • Loading branch information
prantlf committed Jul 22, 2022
1 parent 4c0fdb9 commit 8bfb996
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export function validate(build: string): boolean

export function parse(build: string): Date

export function format(date: string | Date): Date
export function format(date: string | Date): string
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"browser": "dist/index.umd.min.js",
"types": "lib/index.d.ts",
"exports": {
"require": "./dist/index.js",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"bin": {
Expand All @@ -44,10 +44,10 @@
],
"scripts": {
"prepare": "rollup -c",
"lint": "denolint",
"check": "npx buildnumgen && teru-cjs tests/*.cjs && teru-esm tests/*.js",
"lint": "denolint && tsc --noEmit tests/types.ts",
"check": "teru-cjs tests/*.cjs && teru-esm tests/*.js",
"cover": "c8 teru-esm tests/*.js",
"test": "denolint && npx buildnumgen && teru-cjs tests/*.cjs && c8 teru-esm tests/*.js"
"test": "denolint && tsc --noEmit tests/types.ts && npx buildnumgen && teru-cjs tests/*.cjs && c8 teru-esm tests/*.js"
},
"c8": {
"check-coverage": true,
Expand Down Expand Up @@ -87,7 +87,8 @@
"sprintf-js": "^1.1.2",
"tehanu": "^1.0.1",
"tehanu-repo-coco": "^1.0.0",
"tehanu-teru": "^1.0.0"
"tehanu-teru": "^1.0.0",
"typescript": "^4.7.4"
},
"keywords": [
"buildnumber",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tests/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { generate, validate, parse, format } from 'build-number-generator'

let _generated: string
_generated = generate()
_generated = generate('1.0.3')
_generated = generate({ version: '1.0.3' })
_generated = generate({ version: '2018/06', versionSeparator: '-' })

const _validated: boolean = validate('1.0.3.180625392')

const _parsed: Date = parse('1.0.3.180625392')

let _formatted: string
_formatted = format('1.0.3.180625392')
_formatted = format(new Date)

0 comments on commit 8bfb996

Please sign in to comment.