Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions types/ClientContext.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NullstackEnvironment } from './Environment'
import { NullstackInstances } from './Instances'
import { NullstackFragment } from './JSX'
import { NullstackPage } from './Page'
import { NullstackParams } from './Params'
Expand All @@ -10,7 +11,7 @@ import { NullstackWorker } from './Worker'
/**
* @see https://nullstack.app/context
*/
export type NullstackClientContext<TProps = unknown> = TProps & {
interface BaseNullstackClientContext {
/**
* Callback function that bootstrap the context for the application.
*/
Expand Down Expand Up @@ -53,7 +54,7 @@ export type NullstackClientContext<TProps = unknown> = TProps & {
* @scope client
* @see https://nullstack.app/context-instances
*/
instances: Record<string, unknown>
instances: NullstackInstances

/**
* It gives you information about the current environment.
Expand Down Expand Up @@ -129,3 +130,5 @@ export type NullstackClientContext<TProps = unknown> = TProps & {

element?: HTMLElement
}

export type NullstackClientContext<TProps = unknown> = BaseNullstackClientContext & TProps
2 changes: 1 addition & 1 deletion types/Environment.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type NullstackEnvironment = {
export interface NullstackEnvironment {
client: boolean

server: boolean
Expand Down
1 change: 1 addition & 0 deletions types/Instances.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export interface NullstackInstances extends Record<string, unknown> {}
2 changes: 1 addition & 1 deletion types/Page.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type NullstackPage = {
export interface NullstackPage {
/**
* Current page title
*
Expand Down
4 changes: 2 additions & 2 deletions types/Plugin.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NullstackClientContext } from './ClientContext'
import { AllHTMLAttributes, NullstackAttributes } from './JSX'

type NullstackPluginNode = {
interface NullstackPluginNode {
type: string | boolean
attributes: AllHTMLAttributes<HTMLElement> & NullstackAttributes
children: NullstackClientContext['children']
Expand All @@ -11,7 +11,7 @@ interface NullstackNodeContext extends NullstackClientContext {
node: NullstackPluginNode
}

export type NullstackPlugin = {
export interface NullstackPlugin {
/**
* Runs transformation to node element
* @param context Context with node attributes
Expand Down
2 changes: 1 addition & 1 deletion types/Project.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type NullstackProject = {
export interface NullstackProject {
domain: string

/**
Expand Down
3 changes: 3 additions & 0 deletions types/Request.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Request } from 'express'

export interface NullstackRequest extends Request {}
3 changes: 3 additions & 0 deletions types/Response.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Response } from 'express'

export interface NullstackResponse extends Response {}
2 changes: 1 addition & 1 deletion types/Router.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type NullstackRouter = {
export interface NullstackRouter {
/**
* The router path including query params.
* Does not contain the domain and port.
Expand Down
2 changes: 1 addition & 1 deletion types/Secrets.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type NullstackSecrets = Record<string, string | boolean>
export interface NullstackSecrets extends Record<string, string | boolean> {}
2 changes: 1 addition & 1 deletion types/Server.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type NullstackServer = {
export interface NullstackServer {
get(...args)

post(...args)
Expand Down
10 changes: 7 additions & 3 deletions types/ServerContext.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { NullstackEnvironment } from './Environment'
import { NullstackProject } from './Project'
import { NullstackRequest } from './Request'
import { NullstackResponse } from './Response'
import { NullstackSecrets } from './Secrets'
import { NullstackServer } from './Server'
import { NullstackSettings } from './Settings'
Expand All @@ -8,7 +10,7 @@ import { NullstackWorker } from './Worker'
/**
* @see https://nullstack.app/context
*/
export type NullstackServerContext<TProps = unknown> = TProps & {
interface BaseNullstackServerContext {
/**
* Callback function that bootstrap the context for the application.
*/
Expand Down Expand Up @@ -49,15 +51,15 @@ export type NullstackServerContext<TProps = unknown> = TProps & {
* @scope server
* @see https://nullstack.app/server-request-and-response
*/
request?: Record<string, any>
request?: NullstackRequest

/**
* Original `response` object from [Express](https://expressjs.com/)
*
* @scope server
* @see https://nullstack.app/server-request-and-response
*/
response?: Record<string, any>
response?: NullstackResponse

/**
* You can assign any key with any type of public information.
Expand All @@ -83,3 +85,5 @@ export type NullstackServerContext<TProps = unknown> = TProps & {
*/
secrets: NullstackSecrets
}

export type NullstackServerContext<TProps = unknown> = BaseNullstackServerContext & TProps
2 changes: 1 addition & 1 deletion types/Settings.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type NullstackSettings = Record<string, string | boolean>
export interface NullstackSettings extends Record<string, string | boolean> {}
2 changes: 1 addition & 1 deletion types/Worker.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type NullstackWorker = {
export interface NullstackWorker {
/**
* - keys: server functions names
* - values: array of these functions arguments
Expand Down
3 changes: 3 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import { NullstackServerContext } from './ServerContext'

export * from './ClientContext'
export * from './Environment'
export * from './Instances'
export * from './Page'
export * from './Params'
export * from './Plugin'
export * from './Project'
export * from './Request'
export * from './Response'
export * from './Router'
export * from './Secrets'
export * from './Server'
Expand Down