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

🎉 Congratulations!. You are done with the core concepts!

⚔ Learn about the Transpilation and Security.

Have any questions or suggestions? Join our Discord