04 2022 档案
摘要:export type Letter = 'a' | 'b' | 'c' type RemoveC<TType> = TType extends 'c' ? never: TType; type WithoutC = RemoveC<Letter>;
阅读全文
摘要:class SDK { constructor(public loggedInUserId?: string) {} createPost(title: string) { this.assertUserIsLoggedIn(); createPost(this.loggedInUserId, ti
阅读全文
摘要:Config store app/store.ts import { configureStore } from "@reduxjs/toolkit"; export const store = configureStore({ reducer: {} }); main.tsx import Rea
阅读全文
摘要:Let's see when we have following code: interface Animal { name: string; } interface Human { firstName: string; lastName: string; } const getDisplayNam
阅读全文
摘要:For example we have a type like this: type Obj = { a: "a"; a2: "a2"; a3: "a3"; b: "b"; b1: "b1"; b2: "b2"; }; We want to constrct a new type which por
阅读全文
摘要:For example we have two types, we want to find the shared props in both: interface UserBase { email: string image: string | null username: string } in
阅读全文
摘要:Let's say we have a function accept any type but array. function anyTypesButNotArray<T>( val: T extends any[] ? "you should not pass in array" : T ) {
阅读全文
摘要:Constructs a type consisting of the return type of function Type. https://www.typescriptlang.org/docs/handbook/utility-types.html import { configureSt
阅读全文
摘要:This lesson demonstrates that you can get a small performance gain by removing AJAX calls that feed into redux from the react/hooks lifecycle. In this
阅读全文
摘要:This lessons builds on Build lodash.debounce from scratch to add support for one of its more interesting options: maxWait. The maxWait option ensures
阅读全文
摘要:This lesson will demonstrate how to recreate a simplified version of the popular lodash.debounce method from scratch. I literally failed a job intervi
阅读全文
摘要:This lesson will demonstrate how to recreate a simplified version of the popular lodash.merge method from scratch. First we'll create a test file with
阅读全文
摘要:Company plans to deploy Docker containers on AWS at lowest cost? Use ECS with a clsuter of SPot instances and enable Spot instance draining. Company p
阅读全文
摘要:High availability and elastic scalbility for web servers? Use EC2 Auto Scaling and An application load balancer across multi AZs. Low-Latency connecti
阅读全文
摘要:Global compnay needs to centrally manage creation of infrastructure services to accounts in AWS organizations? Define infrastructure in CloudFormation
阅读全文
摘要:Snowball Edge used to transfer millions of small fiels using a shell script. Transfer times are very slow? Perform multiple copy operations at one tim
阅读全文
摘要:Secuirty logs generated by AWS WAF musts be sent to a third-party auditing application? Send logs to Kinesis Data Firehose and configure the auditing
阅读全文
摘要:API activity must be captured from multiple accounts and stored in a centra security account? Use CloudTrail in each account to record API activity an
阅读全文
摘要:We'll learn how to use Next.js API Routes to hide sensitive information from the clients. In this case, we're calling the JSON Placeholder API with a
阅读全文
摘要:We'll learn how to create a middleware function for next-connect. This middleware will work at the route level, for example, for every request that hi
阅读全文
摘要:We'll learn an alternative way of creating API routes using the next-connect package. next-connect gives us an alternative that would feel familiar to
阅读全文