1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-01-03 18:35:07 +01:00

typing updates

This commit is contained in:
Matthias Kretschmann 2021-03-15 21:01:55 +01:00
parent a5ec31af33
commit 01e2821132
Signed by: m
GPG Key ID: 606EEEF3C479A91F
10 changed files with 96 additions and 94 deletions

82
package-lock.json generated
View File

@ -3353,9 +3353,9 @@
} }
}, },
"@types/node": { "@types/node": {
"version": "14.14.34", "version": "14.14.35",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.34.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.35.tgz",
"integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA==" "integrity": "sha512-Lt+wj8NVPx0zUmUwumiVXapmaLUcAk3yPuHCFVXras9k5VT9TdhJqKqGVUQCD60OTMCl0qxJ57OiTL0Mic3Iag=="
}, },
"@types/node-fetch": { "@types/node-fetch": {
"version": "2.5.8", "version": "2.5.8",
@ -3555,12 +3555,12 @@
"integrity": "sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg==" "integrity": "sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg=="
}, },
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "4.17.0", "version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.17.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.18.0.tgz",
"integrity": "sha512-/fKFDcoHg8oNan39IKFOb5WmV7oWhQe1K6CDaAVfJaNWEhmfqlA24g+u1lqU5bMH7zuNasfMId4LaYWC5ijRLw==", "integrity": "sha512-Lzkc/2+7EoH7+NjIWLS2lVuKKqbEmJhtXe3rmfA8cyiKnZm3IfLf51irnBcmow8Q/AptVV0XBZmBJKuUJTe6cQ==",
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "4.17.0", "@typescript-eslint/experimental-utils": "4.18.0",
"@typescript-eslint/scope-manager": "4.17.0", "@typescript-eslint/scope-manager": "4.18.0",
"debug": "^4.1.1", "debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"lodash": "^4.17.15", "lodash": "^4.17.15",
@ -3580,50 +3580,50 @@
} }
}, },
"@typescript-eslint/experimental-utils": { "@typescript-eslint/experimental-utils": {
"version": "4.17.0", "version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.17.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.18.0.tgz",
"integrity": "sha512-ZR2NIUbnIBj+LGqCFGQ9yk2EBQrpVVFOh9/Kd0Lm6gLpSAcCuLLe5lUCibKGCqyH9HPwYC0GIJce2O1i8VYmWA==", "integrity": "sha512-92h723Kblt9JcT2RRY3QS2xefFKar4ZQFVs3GityOKWQYgtajxt/tuXIzL7sVCUlM1hgreiV5gkGYyBpdOwO6A==",
"requires": { "requires": {
"@types/json-schema": "^7.0.3", "@types/json-schema": "^7.0.3",
"@typescript-eslint/scope-manager": "4.17.0", "@typescript-eslint/scope-manager": "4.18.0",
"@typescript-eslint/types": "4.17.0", "@typescript-eslint/types": "4.18.0",
"@typescript-eslint/typescript-estree": "4.17.0", "@typescript-eslint/typescript-estree": "4.18.0",
"eslint-scope": "^5.0.0", "eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0" "eslint-utils": "^2.0.0"
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "4.17.0", "version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.17.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.18.0.tgz",
"integrity": "sha512-KYdksiZQ0N1t+6qpnl6JeK9ycCFprS9xBAiIrw4gSphqONt8wydBw4BXJi3C11ywZmyHulvMaLjWsxDjUSDwAw==", "integrity": "sha512-W3z5S0ZbecwX3PhJEAnq4mnjK5JJXvXUDBYIYGoweCyWyuvAKfGHvzmpUzgB5L4cRBb+cTu9U/ro66dx7dIimA==",
"requires": { "requires": {
"@typescript-eslint/scope-manager": "4.17.0", "@typescript-eslint/scope-manager": "4.18.0",
"@typescript-eslint/types": "4.17.0", "@typescript-eslint/types": "4.18.0",
"@typescript-eslint/typescript-estree": "4.17.0", "@typescript-eslint/typescript-estree": "4.18.0",
"debug": "^4.1.1" "debug": "^4.1.1"
} }
}, },
"@typescript-eslint/scope-manager": { "@typescript-eslint/scope-manager": {
"version": "4.17.0", "version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.17.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.18.0.tgz",
"integrity": "sha512-OJ+CeTliuW+UZ9qgULrnGpPQ1bhrZNFpfT/Bc0pzNeyZwMik7/ykJ0JHnQ7krHanFN9wcnPK89pwn84cRUmYjw==", "integrity": "sha512-olX4yN6rvHR2eyFOcb6E4vmhDPsfdMyfQ3qR+oQNkAv8emKKlfxTWUXU5Mqxs2Fwe3Pf1BoPvrwZtwngxDzYzQ==",
"requires": { "requires": {
"@typescript-eslint/types": "4.17.0", "@typescript-eslint/types": "4.18.0",
"@typescript-eslint/visitor-keys": "4.17.0" "@typescript-eslint/visitor-keys": "4.18.0"
} }
}, },
"@typescript-eslint/types": { "@typescript-eslint/types": {
"version": "4.17.0", "version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.17.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.18.0.tgz",
"integrity": "sha512-RN5z8qYpJ+kXwnLlyzZkiJwfW2AY458Bf8WqllkondQIcN2ZxQowAToGSd9BlAUZDB5Ea8I6mqL2quGYCLT+2g==" "integrity": "sha512-/BRociARpj5E+9yQ7cwCF/SNOWwXJ3qhjurMuK2hIFUbr9vTuDeu476Zpu+ptxY2kSxUHDGLLKy+qGq2sOg37A=="
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "4.17.0", "version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.17.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.18.0.tgz",
"integrity": "sha512-lRhSFIZKUEPPWpWfwuZBH9trYIEJSI0vYsrxbvVvNyIUDoKWaklOAelsSkeh3E2VBSZiNe9BZ4E5tYBZbUczVQ==", "integrity": "sha512-wt4xvF6vvJI7epz+rEqxmoNQ4ZADArGQO9gDU+cM0U5fdVv7N+IAuVoVAoZSOZxzGHBfvE3XQMLdy+scsqFfeg==",
"requires": { "requires": {
"@typescript-eslint/types": "4.17.0", "@typescript-eslint/types": "4.18.0",
"@typescript-eslint/visitor-keys": "4.17.0", "@typescript-eslint/visitor-keys": "4.18.0",
"debug": "^4.1.1", "debug": "^4.1.1",
"globby": "^11.0.1", "globby": "^11.0.1",
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
@ -3642,11 +3642,11 @@
} }
}, },
"@typescript-eslint/visitor-keys": { "@typescript-eslint/visitor-keys": {
"version": "4.17.0", "version": "4.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.17.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.18.0.tgz",
"integrity": "sha512-WfuMN8mm5SSqXuAr9NM+fItJ0SVVphobWYkWOwQ1odsfC014Vdxk/92t4JwS1Q6fCA/ABfCKpa3AVtpUKTNKGQ==", "integrity": "sha512-Q9t90JCvfYaN0OfFUgaLqByOfz8yPeTAdotn/XYNm5q9eHax90gzdb+RJ6E9T5s97Kv/UHWKERTmqA0jTKAEHw==",
"requires": { "requires": {
"@typescript-eslint/types": "4.17.0", "@typescript-eslint/types": "4.18.0",
"eslint-visitor-keys": "^2.0.0" "eslint-visitor-keys": "^2.0.0"
} }
}, },
@ -8826,8 +8826,8 @@
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
}, },
"ethereum-blockies": { "ethereum-blockies": {
"version": "git+ssh://git@github.com/MyEtherWallet/blockies.git#d36f87e50149aacafb34f099fe0bea1df76e010c", "version": "github:MyEtherWallet/blockies#d36f87e50149aacafb34f099fe0bea1df76e010c",
"from": "ethereum-blockies@github:MyEtherWallet/blockies" "from": "github:MyEtherWallet/blockies"
}, },
"event-emitter": { "event-emitter": {
"version": "0.3.5", "version": "0.3.5",
@ -17004,8 +17004,8 @@
"integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=" "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI="
}, },
"nord-visual-studio-code": { "nord-visual-studio-code": {
"version": "git+ssh://git@github.com/arcticicestudio/nord-visual-studio-code.git#5186990b2c8ba8cec1251d4ff3739cdab246e691", "version": "github:arcticicestudio/nord-visual-studio-code#5186990b2c8ba8cec1251d4ff3739cdab246e691",
"from": "nord-visual-studio-code@github:arcticicestudio/nord-visual-studio-code" "from": "github:arcticicestudio/nord-visual-studio-code"
}, },
"normalize-package-data": { "normalize-package-data": {
"version": "2.5.0", "version": "2.5.0",

View File

@ -92,15 +92,15 @@
"@types/jest": "^26.0.20", "@types/jest": "^26.0.20",
"@types/loadable__component": "^5.13.3", "@types/loadable__component": "^5.13.3",
"@types/lunr": "^2.3.3", "@types/lunr": "^2.3.3",
"@types/node": "^14.14.34", "@types/node": "^14.14.35",
"@types/node-fetch": "^2.5.8", "@types/node-fetch": "^2.5.8",
"@types/react": "^17.0.3", "@types/react": "^17.0.3",
"@types/react-dom": "^17.0.2", "@types/react-dom": "^17.0.2",
"@types/react-helmet": "^6.1.0", "@types/react-helmet": "^6.1.0",
"@types/react-transition-group": "^4.4.0", "@types/react-transition-group": "^4.4.0",
"@types/shortid": "^0.0.29", "@types/shortid": "^0.0.29",
"@typescript-eslint/eslint-plugin": "^4.17.0", "@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.17.0", "@typescript-eslint/parser": "^4.18.0",
"@welldone-software/why-did-you-render": "^6.1.1", "@welldone-software/why-did-you-render": "^6.1.1",
"eslint": "^7.22.0", "eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0", "eslint-config-prettier": "^8.1.0",

View File

@ -10,17 +10,19 @@ export default function Menu(): ReactElement {
const [menuOpen, setMenuOpen] = useState(false) const [menuOpen, setMenuOpen] = useState(false)
const { menu } = useSiteMetadata() const { menu } = useSiteMetadata()
const toggleMenu = () => { function toggleMenu(): void {
setMenuOpen(!menuOpen) setMenuOpen(!menuOpen)
} }
const MenuItems = menu.map((item: MenuItem) => ( const MenuItems = menu.map(
<li key={item.title}> (item: MenuItem): JSX.Element => (
<Link onClick={toggleMenu} to={item.link}> <li key={item.title}>
{item.title} <Link onClick={toggleMenu} to={item.link}>
</Link> {item.title}
</li> </Link>
)) </li>
)
)
return ( return (
<> <>

View File

@ -9,7 +9,7 @@ import {
pagination pagination
} from './Pagination.module.css' } from './Pagination.module.css'
const PageNumber = ({ function PageNumber({
i, i,
slug, slug,
current current
@ -17,7 +17,7 @@ const PageNumber = ({
i: number i: number
slug: string slug: string
current?: boolean current?: boolean
}) => { }): JSX.Element {
const classes = current ? styleCurrent : styleNumber const classes = current ? styleCurrent : styleNumber
const link = i === 0 ? slug : `${slug}page/${i + 1}` const link = i === 0 ? slug : `${slug}page/${i + 1}`
@ -34,7 +34,7 @@ function PrevNext({
}: { }: {
prevPagePath?: string prevPagePath?: string
nextPagePath?: string nextPagePath?: string
}) { }): JSX.Element {
const link = prevPagePath || nextPagePath const link = prevPagePath || nextPagePath
const rel = prevPagePath ? 'prev' : 'next' const rel = prevPagePath ? 'prev' : 'next'
const title = prevPagePath ? 'Newer Posts' : 'Older Posts' const title = prevPagePath ? 'Newer Posts' : 'Older Posts'

View File

@ -21,7 +21,7 @@ function postsWithDataFilter(
posts: [{ node: Post }], posts: [{ node: Post }],
key: keyof Frontmatter, key: keyof Frontmatter,
valuesToFind: string[] valuesToFind: string[]
) { ): { node: Post }[] {
const newArray = posts const newArray = posts
.filter(({ node }: { node: Post }) => { .filter(({ node }: { node: Post }) => {
const frontmatterKey = node.frontmatter[key] as [] const frontmatterKey = node.frontmatter[key] as []
@ -39,7 +39,7 @@ function postsWithDataFilter(
return newArray return newArray
} }
function photosWithDataFilter(posts: []) { function photosWithDataFilter(posts: [{ node: Post }]): { node: Post }[] {
const newArray = posts const newArray = posts
.filter((post: { node: Post }) => { .filter((post: { node: Post }) => {
const { fileAbsolutePath } = post.node const { fileAbsolutePath } = post.node

View File

@ -2,8 +2,13 @@ import React, { ReactElement } from 'react'
import { searchButton } from './SearchButton.module.css' import { searchButton } from './SearchButton.module.css'
import Icon from '../../atoms/Icon' import Icon from '../../atoms/Icon'
const SearchButton = (props: any): ReactElement => ( const SearchButton = ({ onClick }: { onClick: () => void }): ReactElement => (
<button type="button" title="Search" className={searchButton} {...props}> <button
type="button"
title="Search"
className={searchButton}
onClick={onClick}
>
<Icon name="Search" /> <Icon name="Search" />
</button> </button>
) )

View File

@ -26,7 +26,7 @@ export default function Search(): ReactElement {
) )
}, [query]) }, [query])
const toggleSearch = () => { function toggleSearch(): void {
setSearchOpen(!searchOpen) setSearchOpen(!searchOpen)
} }

View File

@ -17,10 +17,9 @@ const constructMessage = (
message?: { text?: string } message?: { text?: string }
) => ) =>
transactionHash transactionHash
? message && ? message?.text +
message.text + '<br /><br />' +
'<br /><br />' + getTransactionMessage(transactionHash).transaction
getTransactionMessage(transactionHash).transaction
: message && message.text : message && message.text
const classes = (status: string) => const classes = (status: string) =>

View File

@ -1,4 +1,4 @@
import React, { ReactElement, PureComponent } from 'react' import React from 'react'
import { Link } from 'gatsby' import { Link } from 'gatsby'
import Icon from '../atoms/Icon' import Icon from '../atoms/Icon'
import Vcard from '../molecules/Vcard' import Vcard from '../molecules/Vcard'
@ -30,13 +30,11 @@ function Copyright() {
) )
} }
export default class Footer extends PureComponent { export default function Footer(): JSX.Element {
render(): ReactElement { return (
return ( <footer role="contentinfo" className={footer}>
<footer role="contentinfo" className={footer}> <Vcard />
<Vcard /> <Copyright />
<Copyright /> </footer>
</footer> )
)
}
} }

View File

@ -1,4 +1,4 @@
import React, { ReactElement, PureComponent } from 'react' import React from 'react'
import { Link } from 'gatsby' import { Link } from 'gatsby'
import Search from '../molecules/Search' import Search from '../molecules/Search'
import Menu from '../molecules/Menu' import Menu from '../molecules/Menu'
@ -6,24 +6,22 @@ import ThemeSwitch from '../molecules/ThemeSwitch'
import { ReactComponent as Logo } from '../../images/logo.svg' import { ReactComponent as Logo } from '../../images/logo.svg'
import { header, headerContent, title, logo, nav } from './Header.module.css' import { header, headerContent, title, logo, nav } from './Header.module.css'
export default class Header extends PureComponent { export default function Header(): JSX.Element {
render(): ReactElement { return (
return ( <header role="banner" className={header}>
<header role="banner" className={header}> <div className={headerContent}>
<div className={headerContent}> <h1 className={title}>
<h1 className={title}> <Link to="/">
<Link to="/"> <Logo className={logo} /> kremalicious
<Logo className={logo} /> kremalicious </Link>
</Link> </h1>
</h1>
<nav role="navigation" className={nav}> <nav role="navigation" className={nav}>
<ThemeSwitch /> <ThemeSwitch />
<Search /> <Search />
<Menu /> <Menu />
</nav> </nav>
</div> </div>
</header> </header>
) )
}
} }