Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined 대신 null 이용 #15

Open
degurii opened this issue Mar 17, 2022 · 1 comment
Open

undefined 대신 null 이용 #15

degurii opened this issue Mar 17, 2022 · 1 comment
Labels
refactor Refactoring production code

Comments

@degurii
Copy link
Owner

degurii commented Mar 17, 2022

  • 현재: null을 사용하지 않고, undefined만 사용
  • 변경: undefined를 사용하지 않고, null을 사용하도록 함

한번 undefined만 사용해봤는데 생각보다 애매함.

  1. 타입 정의할땐 편함. 있을 수도 있고, 없을 수도 있으면 그냥 ?: 로 타입 선언하면 됨.
  2. 파라미터 정의할때도 편함. ?:로 선언하면 됨.
  3. 자바스크립트 자체 함수가 undefined를 반환할 때가 많음. 이때 같이 호환돼서 편함
  4. 근데 이거 외에는 별로인 것 같음
  5. 대표적으로 함수 인자나 props 같은 경우 이게 사용자 실수로 인자를 빠뜨린건지, undefined를 유도해서 빠뜨린건지 확인할 방도가 없음.
  6. 그래서 코드가 굉장히 불확실함
@degurii degurii added the refactor Refactoring production code label Mar 17, 2022
@degurii
Copy link
Owner Author

degurii commented Mar 17, 2022

이거는 점진적으로 눈에 보일때마다 바꿔가도록 하고, 따로 브랜치를 파지는 않기로 하자.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring production code
Projects
None yet
Development

No branches or pull requests

1 participant