Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ergodark/next-types

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ergodark/next-types

Various utility and helper types for Next.js projects

  • 1.0.17
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm
version

@ergodark/next-types

This package contains various utility and helper types that can be imported by a Next.js project.

This package only contains TypeScript types. This package also exports all the types from @ergodark/types, so there is no need to install both packages.

Install

npm install @ergodark/next-types

Usage

You can use this library's types in your TypeScript projects like so:

import type { TypeNameHere } from '@ergodark/next-types'

const variable: TypeNameHere;
import type * as ErgoDark from '@ergodark/next-types'

const variable: ErgoDark.TypeNameHere;

Type Glossary

Along with the types exposed by @ergodark/types, this library provides the following types:

NextParamsRR<T>

Represents an object with well-defined NextApiRequest and NextApiResponse properties where generic type T is passed to NextApiResponse<T>.

Specifying T is optional. By default, T = Record<string, unknown>.

import type { NextParamsRR } from '@ergodark/next-types'

export async function addToRequestLog({ req, res }: NextParamsRR) {
    ...
}

WithConfig<T>

Adds a config property to type T. Useful for dealing with Next endpoints that require custom configuration when writing unit tests.

import * as Endpoint from 'pages/api-endpoint'

import type { WithConfig } from '@ergodark/next-types'

const endpoint: WithConfig<typeof Endpoint.default> = Endpoint.default;
endpoint.config = Endpoint.config;

Contributing

Issues and pull requests are welcome! In lieu of a formal styleguide, take care to maintain the existing coding style.

Please test your code!

Release History

  • 1.0.x Initial release

Keywords

FAQs

Package last updated on 15 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc