webdev/typescript

typescript

dz / webdev / typescript

Node Tree

Nodes

declaration_files
content Declaration Files in Typescript
hyperlink https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

discriminated_union
content Discriminated Union: When every type in a union contains a common property, and can narrow out the fields in the union.
children discriminant_property
hyperlink https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
flashcard (front) What is a discriminated union?
flashcard (back) A discriminated union happens when every type in a union contains a common property.

discriminant_property
content Discriminant Property: a common property found amongst types in a discriminated union.
parents discriminated_union

function_overloading
content Function Overloading
children overload_signature, implementation_signature

overload_signature
content overload signature: in function overloading, these are function signatures that specify the various overloads
children implementation_signature (overload signatures must be compatible with the,implementation signature)
parents function_overloading
flashcard (front) What is an overload signature?
flashcard (back) Overload signatures are used in the context of function overloading in typescript. They refer to the function signatures that define the various input parameter combinations.

implementation_signature
content Implementation Signature: the function signature below the overload signatures
parents overload_signature, function_overloading
flashcard (front) What is an implementation signature?
flashcard (back) In function overloading, the implementation signature is the function signature below the overload signatures.

excess_property_checking
content Excess Property Checking: an special check that typescript performs on object literals. If there are properties that the "target type" object literal doesn't have, an error will be produced. This sort of error would typically fail silently in JavaScript.
hyperlink https://www.typescriptlang.org/docs/handbook/2/objects.html#excess-property-checks
flashcard (front) What is excess property checking in typescript?
flashcard (back) excess property checking is a check performed on object literals, and will check for properties not in the target object literal.

identity_function
content Identity Function: "hello world" of generics, a function that will return back whatever it is passed in.
hyperlink https://www.typescriptlang.org/docs/handbook/2/generics.html#hello-world-of-generics
flashcard (front) What is the identity function?
flashcard (back) A function that will return back whatever it is passed in.

generic_constraint
content Generic Constraint =function stuff<Type extends foo>(arg: Type)=
flashcard (front) what does generic constraint syntax look like?
flashcard (back) =function stuff(arg: Type)=.

generic_parameter_default
content Generic Parameter Default: by providing default values, generic parameters can be optional.
flashcard (front) What is an example of using default generic parameters?
flashcard (back) function foo(a: T, b: T) { return [a, b]; }

covariance_contravariance_wiki
content Covariance and Contravariance: wikipedia
parents covariance_contravariance
remarks found while reading typescript handbook
hyperlink https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)

covariance_contravariance
content Covariance and contravariance: type theory terms describing the relationship between two generic types.
children covariance_contravariance_wiki (more information)
hyperlink https://www.typescriptlang.org/docs/handbook/2/generics.html#variance-annotations
flashcard (front) what is an example of covariance and contravariance?
flashcard (back) Producer where Producer expected: Cat is an Animal, covariance. Consumer where Consumer expected: any function that is capable of accepting a Cat must also be capable of accepting an animal, contravariance.