cctv

Type Safety and Runtime Safety Part.1/2: model, validator & data

TypeScript makes JavaScript even stronger with a strongly-typed system, which is a merit for developers. TypeScript checks our static code before running it. That is so called type safety. However, runtime safety is checking our code at runtime with real data. In runtime, TypeScript files are already compiled to JavaScript. So static type check is not available. It means: type safe does not mean runtime safe The post is divided into two parts....

Mar 17, 2024 Published · Oct 3, 2024 Updated · 5 min · Inori Inuyama
cctv

Type Safety and Runtime Safety Part.2/2: page, route guard & API

The post is divided into two parts. If you want to read part 1 first, please go to here. As part 1 is about runtime validation. Part 2 will focus on use cases. I will use Nuxt3 as example. Here I have 3 use cases: page, route guard (Vue route) and API. Prerequisite Basic knowledge: JavaScript, TypeScript, Nuxt3, Vue3, zod Case 1: Page Validation Suppose we have a post list page with route: /posts?...

Mar 17, 2024 Published · Oct 3, 2024 Updated · 7 min · Inori Inuyama

Create Hugo Post With NPM Script

Prerequisite Basic knowledge: NPM, Hugo, JavaScript, shell script Pre-installed: VS Code, NPM CLI, Hugo CLI Intro Create a post using hugo CLI is a tedious work for me. Because I always create a post using archetype and placing it in nested folder. For example, when creating this post, I should type the command below in the terminal: hugo new --kind develop posts/_developer/create-hugo-post-with-npm-script The problem here is, I always forget how many kind of archetypes I already have, and what my folder structure looks like right now....

Mar 11, 2024 Published · Oct 3, 2024 Updated · 3 min · Inori Inuyama

The First Dive in Multi-Threaded Patterns

Prefix Here’s a little side note from Chapter 6 - Multithreaded Patterns in this book: Multithreaded JavaScript. In this chapter, introducing some multi-threaded patterns: Thread Pool Mutex Ring Buffers Actor Model Thread Pool The thread pool is a very popular pattern that is used in most multithreaded applications in some form or another. A thread pool is a collection of homogeneous worker threads that are each capable of carrying out...

Sep 27, 2022 Published · Oct 3, 2024 Updated · 3 min · Inori Inuyama

E2E Testing Oriented Developing Process

One day, we got a mockup from designer. Then we start crafting the page. At first, we might work on making UI and UX of components. That’s the main part. E2E testing is not a concern at the moment. When developing, if we were luckily get the test case from QAs (or whoever wrote it), should we consider it when crafting our components? (And yeah only if we have enough...

Aug 27, 2022 Published · Oct 3, 2024 Updated · 3 min · Inori Inuyama