일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- 기후변화
- NPM
- ESLint
- OOP
- 객체참조 #객체
- 클로저
- this
- lightsail nodejs apache
- jest
- git pair
- #cloudfront #s3 #html 확장자 없애기
- TypeScript
- url #querystring
- Today
- Total
목록typescript (3)
Hello World...
const paginate = (array: Product[], itemSize: number, page: number) => { return array.slice((page - 1) * itemSize, page * itemSize); }; 클라이언트 사이드에서 페이지네이션 함수를 만들 때 위와 같이 해 보았다. 대충 작동은 하는데 정확하지 않다...;
example src/lib import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import timezone from 'dayjs/plugin/timezone'; dayjs.extend(utc); dayjs.extend(timezone); dayjs.tz.setDefault('Asia/Seoul'); export default dayjs.tz; 특정 페이지 또는 컴포넌트.tsx import dayjs from '@/lib/dayjs-lib'; ... const exampleDate = dayjs().format('YYYY-MM-DD HH:mm'); ...
# typescript 전역 설치 npm install -g typescript # node project 생성 npm init # tsconfig.json 생성 npx tsc --init # 자바스크립트 파일도 사용 가능하게 하기 tsconfig.json -> allowJs: true # ts -> js 파일로 변환 # 전체 npx tsc # 부분 npx tsc app.ts # ts-node 로 타입스크립트 실행하기 npm install -g ts-node ts-node app.ts - 타입스크립트 핸드북 https://www.typescriptlang.org/ko/docs/handbook/intro.html Handbook - The TypeScript Handbook Your first step t..