Skip to content

Commit

Permalink
refactor(v2): Expose docusaurus module type aliases to end-users (#2608)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamChou19815 authored Apr 22, 2020
1 parent bfeb104 commit 61c917f
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 36 deletions.
10 changes: 10 additions & 0 deletions packages/docusaurus-module-type-aliases/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@docusaurus/module-type-aliases",
"version": "2.0.0-alpha.50",
"description": "Docusaurus module type aliases",
"types": "./src/index.d.ts",
"publishConfig": {
"access": "public"
},
"license": "MIT"
}
43 changes: 43 additions & 0 deletions packages/docusaurus-module-type-aliases/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

declare module '@generated/client-modules' {
const clientModules: readonly any[];
export default clientModules;
}

declare module '@generated/docusaurus.config' {
const config: any;
export default config;
}

declare module '@generated/registry' {
const registry: {
readonly [key: string]: [() => Promise<any>, string, string];
};
export default registry;
}

declare module '@generated/routes' {
type Route = {
readonly path: string;
readonly component: any;
readonly exact?: boolean;
};
const routes: Route[];
export default routes;
}

declare module '@generated/routesChunkNames' {
const routesChunkNames: any;
export default routesChunkNames;
}

declare module '@theme/*' {
const component: any;
export default component;
}
1 change: 1 addition & 0 deletions packages/docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"url": "https://github.com/facebook/docusaurus/issues"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.0.0-alpha.50",
"@docusaurus/types": "^2.0.0-alpha.50"
},
"dependencies": {
Expand Down
37 changes: 1 addition & 36 deletions packages/docusaurus/src/client/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,4 @@
* LICENSE file in the root directory of this source tree.
*/

declare module '@generated/client-modules' {
const clientModules: readonly any[];
export default clientModules;
}

declare module '@generated/docusaurus.config' {
const config: any;
export default config;
}

declare module '@generated/registry' {
const registry: {
readonly [key: string]: [() => Promise<any>, string, string];
};
export default registry;
}

declare module '@generated/routes' {
type Route = {
readonly path: string;
readonly component: any;
readonly exact?: boolean;
};
const routes: Route[];
export default routes;
}

declare module '@generated/routesChunkNames' {
const routesChunkNames: any;
export default routesChunkNames;
}

declare module '@theme/*' {
const component: any;
export default component;
}
/// <reference types="@docusaurus/module-type-aliases" />

0 comments on commit 61c917f

Please sign in to comment.