-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sets up a basic TypeScript project which contains a UUID type.
- Loading branch information
1 parent
b12e639
commit 46daf4c
Showing
11 changed files
with
4,067 additions
and
828 deletions.
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,19 @@ | ||
/** | ||
* @since 0.1.0 | ||
*/ | ||
|
||
// ------------------------------------------------------------------------------------- | ||
// model | ||
// ------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* @category model | ||
* @since 0.1.0 | ||
*/ | ||
export type Uuid<V extends UuidVersion = UuidVersion> = string & UuidBrand | ||
|
||
type UuidVersion = 1 | 2 | 3 | 4 | 5 | ||
|
||
interface UuidBrand { | ||
readonly Uuid: unique symbol | ||
} |
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 @@ | ||
// TypeScript Version: 4.0 |
Empty file.
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,19 @@ | ||
import * as _ from '../../src' | ||
|
||
declare const uuid: _.Uuid | ||
|
||
// | ||
// Uuid | ||
// | ||
|
||
declare const uuid1: _.Uuid<1> | ||
declare const uuid2: _.Uuid<2> | ||
declare const uuid3: _.Uuid<3> | ||
declare const uuid4: _.Uuid<4> | ||
declare const uuid5: _.Uuid<5> | ||
// $ExpectError | ||
declare const uuid6: _.Uuid<6> | ||
|
||
const uuidToString: string = uuid | ||
// $ExpectError | ||
const stringToUuid: _.Uuid = 'foo' |
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,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"strictFunctionTypes": true, | ||
"noImplicitReturns": false, | ||
"noUnusedLocals": false, | ||
"noUnusedParameters": false, | ||
"noFallthroughCasesInSwitch": true, | ||
"target": "es5", | ||
"lib": ["es2015", "dom", "dom.iterable"] | ||
} | ||
} |
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,22 @@ | ||
{ | ||
"extends": "dtslint/dtslint.json", | ||
"rules": { | ||
"semicolon": false, | ||
"array-type": false, | ||
"no-unnecessary-generics": false, | ||
"member-access": false, | ||
"no-empty-interface": false, | ||
"no-arg": false, | ||
"no-object-literal-type-assertion": false, | ||
"no-unnecessary-class": false, | ||
"radix": false, | ||
"no-angle-bracket-type-assertion": false, | ||
"object-literal-shorthand": false, | ||
"prefer-object-spread": false, | ||
"whitespace": false, | ||
"use-default-type-parameter": false, | ||
"no-relative-import-in-test": false, | ||
"no-null-undefined-union": false, | ||
"invalid-void": false | ||
} | ||
} |
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,4 @@ | ||
{ | ||
"extends": "@tsconfig/recommended", | ||
"include": ["./src"] | ||
} |