Halcyon and on and on, part II
Halcyon and On and On and On and On and On and On and On and On and On
I like this song.
It is the ending song to Mean Girls and the song at the beginning of the credits too and maybe even for all of the while credits. Regardless of whether it is for this reason or not, this song always makes me feel like I am having a happy ending.
![]() |
Here is a picture of my newt, lol |
Default Parameters
"If a parameter is assigned a default value, TypeScript will infer the variable type to be the same as the default value's type. (This is similar to how TypeScript infers the type of an initialised variable to be the same as the type of its initial value)."
"Parameters with default values don't need a ? after the name, since assigning a default value already implies that they're optional parameters".
Inferring Return Types
"TypeScript can also infer the types of values returned by functions.
It does this by looking at the types of the values after a function's return statements."
I don't really understand how it is that this works, but I think it's also to do with the type that is assigned to any parameter that's used (but what if there is more than one parameter??!).
Explicit Return Types
You can state the return type of the function after the closing parentheses of the parameters.
This also works with arrow functions.
It is cool and can be used for spotting errors and bugs in your code. 🐛
Void Return Type
Interestingly when I tested it out this is the error that I got: A function whose declared type is neither 'void' nor 'any' must return a value.
Documentation Functions
* @param sometimes functions have two or more parameters...
Comments
Post a Comment