Skip to content

Instantly share code, notes, and snippets.

View selcukguler0's full-sized avatar

selçuk güler selcukguler0

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
{
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
@selcukguler0
selcukguler0 / typescript1.md
Created March 31, 2023 09:36
Understanding TypeScript's `satisfies` Operator

Understanding TypeScript's satisfies Operator

TypeScript is a powerful tool for developing large-scale JavaScript applications. One of its key features is the ability to define complex types and interfaces that can be used to enforce type safety throughout your codebase. One lesser-known feature of TypeScript is the satisfies operator, which allows you to check whether an object conforms to a particular type or interface at runtime. In this article, we'll explore how the satisfies operator works, and how you can use it in your own TypeScript projects.

What is the satisfies Operator?

The satisfies operator is a TypeScript feature that allows you to check whether an object conforms to a particular type or interface. It works by taking two arguments: the first is a type or interface, and the second is an object to be checked against that type or interface. Here's an example:

interface Person {
@selcukguler0
selcukguler0 / typescript0.md
Created March 31, 2023 09:21
Typescript - Interface vs Type

Understanding TypeScript Type and Interface

TypeScript is an open-source programming language that is a superset of JavaScript. It adds optional static typing and other features to the language, making it easier to catch errors and write more robust code.

One of the key features of TypeScript is its use of types and interfaces to define data structures and function signatures. In this article, we'll take a closer look at what types and interfaces are, and how they can be used in TypeScript.

TypeScript Types

In TypeScript, types are used to define the shape of data. Types can be used to describe primitive values, such as strings or numbers, as well as complex objects and functions.