Skip to content

Commit

Permalink
[altair-fastify-plugin] Add nodenext compatible typings and exports
Browse files Browse the repository at this point in the history
  • Loading branch information
kingston committed Oct 1, 2024
1 parent 49ed9bf commit aa61bad
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
16 changes: 16 additions & 0 deletions packages/altair-fastify-plugin/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { FastifyPluginCallback } from 'fastify';
import type { AltairFastifyPluginOptions as PluginOptions } from './dist/index';

type FastifyAltair = FastifyPluginCallback<PluginOptions>;

namespace fastifyAltairPlugin {
export type AltairFastifyPluginOptions = PluginOptions;
export const fastifyAltairPlugin: FastifyAltair;
export { fastifyAltairPlugin as default };
}

declare function fastifyAltairPlugin(
...params: Parameters<FastifyAltair>
): ReturnType<FastifyAltair>;

export = fastifyAltairPlugin;
5 changes: 5 additions & 0 deletions packages/altair-fastify-plugin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const fastifyAltairPlugin = require('./dist/index.js').default;

module.exports = fastifyAltairPlugin;
module.exports.default = fastifyAltairPlugin;
module.exports.fastifyAltairPlugin = fastifyAltairPlugin;
4 changes: 2 additions & 2 deletions packages/altair-fastify-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"graphql"
],
"license": "MIT",
"main": "dist/index.js",
"main": "index.js",
"peerDependencies": {
"fastify": "^4.0.3"
},
Expand All @@ -38,5 +38,5 @@
"prepare": "tsc",
"test": "echo \"Error: no test specified\" && exit 0"
},
"types": "dist/index.d.ts"
"types": "index.d.ts"
}

0 comments on commit aa61bad

Please sign in to comment.