Amazing article Alex, well written and explained. Just had a question for you, Why did you initiate the server with TS if you're not using types or TS features?
The answer is "I did use it!" Plenty of times. Here's some examples:
Typescript reminded me that process.env.NOTION_SECRET could be undefined so it lead me to add the error handling that tells the user they need to include an .env file to run the server
There's a TS interface on the server called ThingsToLearn which defines the shape of the data being served to the front end
Typescript helped a TON with the Notion query payload which comes back in a pretty complex shape, and I can use the @notionhq/client built in types to navigate the API within VS Code rather than having to jump back and forth between the documentation
TS also helped all the times I wrote something wrong or stupid and told me to fix it in the moment rather than causing a runtime error, so there's plenty of use of TS that happened in the development of this tutorial that you don't necessarily see in the final product 😉
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Amazing article Alex, well written and explained. Just had a question for you, Why did you initiate the server with TS if you're not using types or TS features?
Hey there! That's a great question.
The answer is "I did use it!" Plenty of times. Here's some examples:
Typescript reminded me that
process.env.NOTION_SECRET
could be undefined so it lead me to add the error handling that tells the user they need to include an.env
file to run the serverThere's a TS interface on the server called
ThingsToLearn
which defines the shape of the data being served to the front endTypescript helped a TON with the Notion query payload which comes back in a pretty complex shape, and I can use the
@notionhq/client
built in types to navigate the API within VS Code rather than having to jump back and forth between the documentationTS also helped all the times I wrote something wrong or stupid and told me to fix it in the moment rather than causing a runtime error, so there's plenty of use of TS that happened in the development of this tutorial that you don't necessarily see in the final product 😉