전체 글
-
typescript에서 제네릭으로 파라미터 defaultValue값 설정시Typescript 2024. 1. 28. 16:50
제네릭으로 파라미터 defaultValue값을 설정 했을때 발생하는 에러 import { useState } from 'react'; import { EditMode, Union } from 'types'; export const useEditMode = ( defaultEditMode: T, ) => { const [isMode, setMode] = useState(defaultEditMode); const handleEdit = (mode: T) => { setMode(mode); }; return { isMode, handleEdit, }; }; // Union 타입 추론 결과 "information" | "visitMessage" | "reset" - 해당 useEditMode에서 제네릭 T를 이..
-
TypeOrm에서 findOption의 order를 이용시 skip과 take의 paginate 오류Nest.js/TypeOrm 2024. 1. 25. 16:02
await this.repository.findAndCount({ select: { id: true, groupId: true, scheduleImage: true, scheduleName: true, startPeriod: true, endPeriod: true, updatedAt: true, schedulePeriods: { id: true, period: true, startTime: true, endTime: true, tourisms: { id: true, contentId: true, stayTime: true, tourismImage: true, title: true, position: true, }, }, }, where: { memberId: memberId, }, relations: {..
-
node.js ioc 라이브러리 inversify.jsTypescript 2024. 1. 22. 17:40
https://www.npmjs.com/package/inversify?activeTab=readme inversify A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.. Latest version: 6.0.2, last published: 3 months ago. Start using inversify in your project by running `npm i inversify`. There are 2795 other www.npmjs.com
-
eslint import/no-unresolved tsconfig.json paths 인식 오류eslint 2024. 1. 19. 12:48
eslint.js module.exports = { parser: '@typescript-eslint/parser', parserOptions: { project: 'tsconfig.json', tsconfigRootDir: __dirname, sourceType: 'module', }, settings: { 'import/resolver': { typescript: { project: './tsconfig.json', }, }, }, plugins: ['@typescript-eslint/eslint-plugin', 'import'], extends: [ 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended', ], root: tru..
-
go와 sql를 사용하기위한 orm대신 sqlc사용Go/sqlc 2024. 1. 13. 23:17
go는 프레임워크도 그렇지만 orm도 딱히 대중적인게 없는듯 하다. sqlc generates type-safe code from SQL https://pkg.go.dev/github.com/kyleconroy/sqlc#section-readme sqlc package - github.com/kyleconroy/sqlc - Go Packages Discover Packages github.com/kyleconroy/sqlc Version: v1.19.1 Opens a new window with list of versions in this module. Published: Jul 13, 2023 License: MIT Opens a new window with license information. Imp..
-
typescript 리터럴 객체에 as const의 반복문 Object.entriesTypescript 2024. 1. 11. 09:19
React Typescript 사용중에 SelectBox 같은 재사용 가능한 토글 메뉴 컴포넌트를 만들고 있는 와중에 export const orderSelectOptions = { orderSubject: '제목순', orderUpdated: '수정일순', orderCreated: '생성일순', } as const; 이런식으로 리터럴 객체에 as const를 이용하여 상수로 만들었다. - 해당 리터럴 객체의 추론 const orderSelectOptions: { readonly orderSubject: "제목순"; readonly orderUpdated: "수정일순"; readonly orderCreated: "생성일순"; } {Object.entries(orderSelectOptions).map(([..
-
Nestjs에서 테스트 코드 작성시 Nest can't resolve dependencies in the RootTestModule context 에러Nest.js/TDD 2024. 1. 9. 20:57
Nest can't resolve dependencies of the ApmService (?). Please make sure that the argument dependency at index [0] is available in the RootTestModule context. Potential solutions: - If dependency is a provider, is it part of the current RootTestModule? - If dependency is exported from a separate @Module, is that module imported within RootTestModule? @Module({ imports: [ /* the Module containing ..