Skip to content

Commit

Permalink
chore(gatsby): Convert is-32-bit-integer to TypeScript (#22138)
Browse files Browse the repository at this point in the history
* chore(gatsby): Convert utils/is-32-bit-integer to TypeScript

* chore(gatsby): Convert schema/infer/is-32-bit-integer to TypeScript

* chore(gatsby) remove duplicated code
  • Loading branch information
Pittan authored Mar 10, 2020
1 parent cc5fb21 commit 407533f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby/src/schema/infer/add-inferred-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const report = require(`gatsby-cli/lib/reporter`)
const { isFile } = require(`./is-file`)
const { isDate } = require(`../types/date`)
const { addDerivedType } = require(`../types/derived-types`)
const is32BitInteger = require(`./is-32-bit-integer`)
import { is32BitInteger } from "../../utils/is-32-bit-integer"

const addInferredFields = ({
schemaComposer,
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/schema/infer/inference-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ type TypeInfoRelatedNode = TypeInfo & {
*/

const { isEqual } = require(`lodash`)
const is32BitInteger = require(`./is-32-bit-integer`)
import { is32BitInteger } from "../../utils/is-32-bit-integer"
const { looksLikeADate } = require(`../types/date`)

const getType = (value, key) => {
Expand Down
3 changes: 0 additions & 3 deletions packages/gatsby/src/schema/infer/is-32-bit-integer.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const is32BitInteger = require(`../is-32-bit-integer.js`)
import { is32BitInteger } from "../is-32-bit-integer"

const MAX_INT = 2147483647
const MIN_INT = -2147483648
Expand Down
3 changes: 0 additions & 3 deletions packages/gatsby/src/utils/is-32-bit-integer.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/gatsby/src/utils/is-32-bit-integer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function is32BitInteger(x: unknown): boolean {
return typeof x === `number` && (x | 0) === x
}

0 comments on commit 407533f

Please sign in to comment.