[VPS Frameworks] TypeScript DX
See original GitHub issueDo typed custom exports/hooks cover all use cases?
Do we forsee shorctomings that we should fix before releasing 0.4?
Custom Exports:
// /pages/_default.page.ts
import type { Config } from 'vilay'
export const config: Config = {
graphqlEndpoint: 'https://api.star-wars.com/_graphql'
}
Custom Hooks:
// /pages/star-wars.page.ts
import type { GetPageMeta, FilterData } from 'vilay'
type Movies = {
title: string,
releaseDate: Date
}
export const getPageMeta: GetPageMeta<Movie> = async movie => {
const { title } = movie
return {
// Determines the `<title>` tag
title,
description: `Everything you ever wanted to know about the Star Wars Movie "${title}".`
}
}
// Filter data to reduce KBs sent to the browser
type MoviesData = Movie & {
much: string,
more: string,
data: string
}
export const filterData: FilterData<MoviesData, Movies> = async function filterData(moviesData) {
const movies = moviesData.map(m => ({ title: m.title, releaseDate: m.releaseDate }))
return movies
}
Note that how the user doens’t access pageContext
; the framework fully abstracts pageContext
away.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Top 5 TypeScript Frameworks (2022)
Top 5 TypeScript Frameworks · Start Learning Backend Dev. Now · Nest.js Framework · FeatherJS Framework · LoopbackJS Framework · Get free NODEJS...
Read more >Reference TypeScript Definitions - DevExtreme - DevExpress
You can find the file with TypeScript definitions for DevExtreme in the DevExtreme zip archive or in the folder where you have installed...
Read more >Which framework should I choose for my project? - OVH
The frameworks are designed to help you structure and automate your projects, from website development to creating complex systems.
Read more >functions-framework-nodejs/typescript.md at master - GitHub
This guide is an example of how to develop a function in Typescript with the Functions Framework. Create a new Node.js project using...
Read more >tRPC - Move Fast and Break Nothing. End-to-end typesafe ...
Move Fast and Break Nothing. End-to-end typesafe APIs made easy. Experience the full power of TypeScript inference to boost productivity
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
With multiple
define*
functions:Default exporting released with
0.4.0-beta.16
.I guess we can close this then.
Let me know if you have other concerns about TS DX.