import create from 'zustand'
interface BearState {
bears: number
increase: (by: number) => void
}
This file contains hidden or 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
import type { Equal, Expect } from '@type-challenges/utils' | |
const tesla = ['tesla', 'model 3', 'model X', 'model Y'] as const | |
const spaceX = ['FALCON 9', 'FALCON HEAVY', 'DRAGON', 'STARSHIP', 'HUMAN SPACEFLIGHT'] as const | |
// 因為 typeof tesla 或是 spaceX 他們的 type 不是 Array 而是 tuple type | |
// type Length<T extends ReadonlyArray<T>> = T['length'] | |
// 這題的情況在意的只是 array 的 length 而已,所以我們可以告訴 ts 說放棄判斷 T 是 array 或是 tuple 取而代之的是用 any[] 或是 unknown[] | |
// type Length<T extends readonly any[]> = T['length'] |
This file contains hidden or 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
export function useEmployees() { | |
const { user } = useAuthentication(); | |
const { client, getRouteURL } = useAPI(); | |
const queryClient = useQueryClient(); | |
/** | |
* @description API `GET` request for obtaining employees data list. | |
*/ | |
const getEmployeesList: QueryFunction<Array<APIStoreUserData>> = | |
useCallback( |
This file contains hidden or 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
import { SetStateAction } from 'react' | |
import { SearchIcon } from '@chakra-ui/icons' | |
import { fireEvent, getByAltText, render, screen } from '@testing-library/react' | |
import { assert, describe, expect, vi } from 'vitest' | |
import { BaseSelect } from './BaseSelect' | |
import { colorOptions } from './mockData/data' | |
describe('BaseSelect', () => { | |
it('show render in screen', () => { |
This file contains hidden or 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
interface Props { | |
children: ReactNode; | |
fallback: (errorMsg: string) => ReactNode | |
} | |
interface State { | |
hasError: boolean; | |
error: Error | null | |
} |
This file contains hidden or 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
export const InputModal = ({ | |
modal, | |
onHide, | |
orderData, | |
materialsOptions, | |
bucketNumOptions, | |
selectedMasterNumb, | |
selectedComponentNumb, | |
selectOrderId, | |
pouringOptions, |
This file contains hidden or 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
const { createProxyMiddleware } = require('http-proxy-middleware'); | |
const express = require('express'); | |
const next = require('next'); | |
const { version, name } = require('./package.json'); | |
const env = process.env.NODE_ENV; | |
const dev = env === 'development'; | |
const port = process.env.PORT || 80; | |
const app = next({ | |
dir: '.', // base directory where everything is, could move to src later |
This file contains hidden or 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
module.exports = { | |
optimization: { | |
// 代碼分割配置 | |
splitChunks: { | |
chunks: "all", // 對所有模塊進行分割 | |
// 以下是默认值 | |
// minSize: 20000, //分割代碼的最小值 | |
// minRemainingSize: 0, // 確保檔案大小不為0 | |
// minChunks: 1, // 滿足引用次數後進行分割 | |
// maxAsyncRequests: 30, // lazy loading同時加載的最大數量 |
This file contains hidden or 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
type Features = { | |
darkMode: () => void; | |
newUserProfile: () => void; | |
userManagement: string; | |
resetPassword: string | |
} | |
type OptionalType<T> = { | |
[key in keyof T]: T[key] extends Function ? T[key] : boolean | |
} | |
type OptionalTypeFeaturesOprionalType = OptionalType<Features> |
This file contains hidden or 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
# *** 2022/05/31 起 *** | |
# | |
# commit log 請遵造以下格式,並注意冒號後面有一個空格 | |
# | |
# <type>(<scope> {非必要}): <subject> {必要} (最多 50 個字) | |
# (一行分行) | |
# <body> {非必要} (最多 72 個字) | |
# (一行分行) | |
# <footer> {非必要} | |
# |
NewerOlder