TypeScript

TypeScript allows you to get auto-complete, rename things, get contextual information about variables, know function parameters, prevent errors before even running your code. You can tune it to be full strict mode, or you can have it be very flexible only providing you the tools to make you more productive.

Nullstack supports TypeScript. All you have to do is rename your file from njs -> nts or jsx -> tsx.

✨ TypeScript is completely optional and you can use pure JavaScript if you prefer.

You can read the full list of types in our GitHub Repo

The two most often types used are NullstackClientContext and NullstackServerContext

import Nullstack, {NullstackClientContext, NullstackServerContext} from 'nullstack'

class TypeScript extends Nullstack {

    // ...
    async serverFunction(context?: NullstackServerContext) {}

    async clientFunction(context?: NuNullstackClientContextls) {}
    // ...

}

Next Step

➡️ Learn more about Build Modes: Server-side renderingHave any questions or suggestions? Join our Discord