Skip to content

Commit

Permalink
build: add a few @ts-ignore to suppress some difficult type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LiosK committed Jan 24, 2023
1 parent c1a8fde commit fde54f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions dist/uuid.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,27 @@ export class UUID {
* UUID internal field values as an array of integers.
* @type {number[]}
*/
// @ts-ignore
this.intFields = new Array(6);
/**
* UUID internal field values as an array of binary strings.
* @type {string[]}
*/
// @ts-ignore
this.bitFields = new Array(6);
/**
* UUID internal field values as an array of hexadecimal strings.
* @type {string[]}
*/
// @ts-ignore
this.hexFields = new Array(6);
for (var i = 0; i < 6; i++) {
var intValue = parseInt(arguments[i] || 0);
// @ts-ignore
this.intFields[i] = this.intFields[names[i]] = intValue;
// @ts-ignore
this.bitFields[i] = this.bitFields[names[i]] = bin(intValue, sizes[i]);
// @ts-ignore
this.hexFields[i] = this.hexFields[names[i]] = hex(intValue, sizes[i] >>> 2);
}
/**
Expand Down Expand Up @@ -375,6 +381,7 @@ UUID._state = null;
// UUID Version 1 Component (2 of 2) {{{
class UUIDState {
constructor() {
// @ts-ignore
var rand = UUID._getRandomInt;
this.timestamp = 0;
this.tick = 0; // timestamp fraction smaller than a millisecond
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"build": "rm -rf ./dist && tsc",
"jsdoc": "rm -rf ./docs && jsdoc -R README.md -d docs ./dist/uuid.js",
"prepare": "npm run build; npm test && npm run test-ts",
"prepare": "npm run build && npm run test && npm run test-ts",
"test": "qunit ./test/index.js",
"test-ts": "tsc --strict --noEmit ./types/*.ts"
},
Expand Down
7 changes: 7 additions & 0 deletions src/uuid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,30 @@ export class UUID {
* UUID internal field values as an array of integers.
* @type {number[]}
*/
// @ts-ignore
this.intFields = new Array(6);

/**
* UUID internal field values as an array of binary strings.
* @type {string[]}
*/
// @ts-ignore
this.bitFields = new Array(6);

/**
* UUID internal field values as an array of hexadecimal strings.
* @type {string[]}
*/
// @ts-ignore
this.hexFields = new Array(6);

for (var i = 0; i < 6; i++) {
var intValue = parseInt(arguments[i] || 0);
// @ts-ignore
this.intFields[i] = this.intFields[names[i]] = intValue;
// @ts-ignore
this.bitFields[i] = this.bitFields[names[i]] = bin(intValue, sizes[i]);
// @ts-ignore
this.hexFields[i] = this.hexFields[names[i]] = hex(
intValue,
sizes[i] >>> 2
Expand Down Expand Up @@ -492,6 +498,7 @@ class UUIDState {
sequence: number;
node: number;
constructor() {
// @ts-ignore
var rand = UUID._getRandomInt;
this.timestamp = 0;
this.tick = 0; // timestamp fraction smaller than a millisecond
Expand Down

0 comments on commit fde54f8

Please sign in to comment.