일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- Props
- HTML
- evm
- API
- CSS
- Interface
- SSR
- CLASS
- typeScript
- 삶
- bitcoin
- built in object
- node.js
- blockchain
- graphQL
- middleware
- concept
- JavaScript
- Redux
- error
- express.js
- solidity
- Ethereum
- hardhat
- nextJS
- useState
- tailwindcss
- 기준
- web
- REACT
- Today
- Total
목록typeScript (22)
ReasonJun
reference : https://kentcdodds.com/blog/wrapping-react-use-state-with-type-script Wrapping React.useState with TypeScript Stay up to date Subscribe to the newsletter to stay up to date with articles, courses and much more! Learn more Stay up to date Subscribe to the newsletter to stay up to date with articles, courses and much more! Learn more All rights reserved © Kent C. D kentcdodds.com
The "not assignable to parameter of type never" error in TypeScript occurs when you try to assign a value of a type that is not never to a parameter of type never. The never type is a special type in TypeScript that represents a value that can never occur. This means that any attempt to assign a value of type never to a parameter of type never will result in an error. For example, the following ..
React.FC and JSX.Element are both types that are used in TypeScript to represent React components. However, there are some key differences between the two types. React.FC is a type that is specifically designed for React components. It has an implicit children prop, which means that the component will accept children even if the children prop is not explicitly defined. React.FC also has default ..
JSX.Element, ReactNode, and ReactElement are all related to React, but they have different meanings and uses. JSX.Element is a type that is used in TypeScript to represent a JSX expression. It is equivalent to the ReactElement type, but its props and type properties are both any. This means that JSX.Element can represent any kind of value, including ReactElements, strings, numbers, and objects. ..
If typescript cannot infer the type and need to do type annotation 1. In case of unilaterally returning any type const json = '{"x": 1, "y": 2}'; const coordinates = JSON.parse(json); console.log(coordinates); 2. If you declare a variable first and initialize it later => In this case, it is inferred as any. let greeting greeting = 'hello' // let greeting: any 3. When the value to be assigned to ..
The void type is used to represent functions that do not return a value. This is typically used for functions that have side effects, such as logging or printing to the console. For example: function logMessage(message: string): void { console.log(message); } const result = logMessage("Hello, world!"); // The result of this function is void The never type is used to represent functions that neve..