cleanup and consistency (#213)

- Made the use of `const` and `let` consistent
- import required functions and types from 'react' instead of using the
  `React.` namespace.
- Added `Expand` type, which can expand complex types to their "final"
  result.
- Ensured that we use `as const` for DEFAULT_XXX_TAG where we used a
  string. So that we have the type of `div` instead of `string` for
  example.
- Used `interface` over `type` where possible. I'm personally more of a
  `type` fan. But the TypeScript recommends `interfaces` where possible
  because they are faster, yield better error messages and so on.
This commit is contained in:
Robin Malfait
2021-01-30 14:46:54 +01:00
committed by GitHub
parent da179ca72b
commit ef00732685
78 changed files with 1115 additions and 1049 deletions
+6 -6
View File
@@ -1,17 +1,17 @@
import '@testing-library/jest-dom/extend-expect'
// Assuming requestAnimationFrame is roughly 60 frames per second
const frame = 1000 / 60
const amountOfFrames = 2
let frame = 1000 / 60
let amountOfFrames = 2
const formatter = new Intl.NumberFormat('en')
let formatter = new Intl.NumberFormat('en')
expect.extend({
toBeWithinRenderFrame(actual, expected) {
const min = expected - frame * amountOfFrames
const max = expected + frame * amountOfFrames
let min = expected - frame * amountOfFrames
let max = expected + frame * amountOfFrames
const pass = actual >= min && actual <= max
let pass = actual >= min && actual <= max
return {
message: pass