mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-01-11 14:52:55 +01:00
Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
13
ts-guidelines.md
Normal file
13
ts-guidelines.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# TS guidelines
|
||||
|
||||
This is a makeshift document that could be good in the future when we grow. maybe.
|
||||
|
||||
|
||||
## TSFixme
|
||||
Since the dawn of time ts-devs have been aliasing `any` to the type `TSFixme` to be able to leave traces in the codebase for whenever they cant be bothered to do proper types, but still want to leave a trail for themselves to know what to fix where. We keep this tradition alive.
|
||||
## any vs unknown
|
||||
We shoud strive to use `unknown` instead of `any`.
|
||||
|
||||
In short `unknown` is the type-safe counterpart of `any`. Anything is assignable to `unknown`, but `unknown` isn't assignable to anything but itself and any without a type assertion or a control flow based narrowing. Likewise, no operations are permitted on an `unknown` without first asserting or narrowing to a more specific type.
|
||||
|
||||
TLDR: use `TSFixme` when youre lazy, and `unknown` when the value is actually unknown.
|
||||
Reference in New Issue
Block a user