I have a root @types
and src
folder
// @types/index.d.ts
import type { Profile } from "passport-discord"
declare module "fastify" {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface PassportUser extends Profile {}
}
declare module "@elastic/ecs-pino-format"
// @TODO: remove when https://github.com/pinojs/pino-elasticsearch/issues/54 has been fixed
declare module "pino-elasticsearch"
In my tsconfig.json
I tried to add "include": ["@types", "src"],
but running my build command
"build": "rimraf dist && NODE_ENV=development npm run nexus:reflect && tsc",
"nexus:reflect": "SHOULD_EXIT_AFTER_GENERATE_ARTIFACTS=true ts-node --transpile-only src/schema.ts",
Results in
daniell@DESKTOP-EKQSHNG:~/GitHub/akira$ npm run build
> akira@1.0.0 build
> rimraf dist && NODE_ENV=development npm run nexus:reflect && tsc
> akira@1.0.0 nexus:reflect
> SHOULD_EXIT_AFTER_GENERATE_ARTIFACTS=true ts-node --transpile-only src/schema.ts
Generated Artifacts:
TypeScript Types ==> /home/daniell/GitHub/akira/node_modules/@types/nexus-typegen/index.d.ts
GraphQL Schema ==> (not enabled)
src/utilities/logger.ts:1:23 - error TS7016: Could not find a declaration file for module '@elastic/ecs-pino-format'. '/home/daniell/GitHub/akira/node_modules/@elastic/ecs-pino-format/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/elastic__ecs-pino-format` if it exists or add a new declaration (.d.ts) file containing `declare module '@elastic/ecs-pino-format';`
1 import ecsFormat from "@elastic/ecs-pino-format"
~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utilities/logger.ts:3:25 - error TS7016: Could not find a declaration file for module 'pino-elasticsearch'. '/home/daniell/GitHub/akira/node_modules/pino-elasticsearch/lib.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/pino-elasticsearch` if it exists or add a new declaration (.d.ts) file containing `declare module 'pino-elasticsearch';`
3 import pinoElastic from "pino-elasticsearch"
~~~~~~~~~~~~~~~~~~~~
Found 2 errors.
How about using ts-node with files
option?
- "nexus:reflect": "SHOULD_EXIT_AFTER_GENERATE_ARTIFACTS=true ts-node --transpile-only src/schema.ts",
+ "nexus:reflect": "SHOULD_EXIT_AFTER_GENERATE_ARTIFACTS=true ts-node --transpile-only --files src/schema.ts",
The docs say ts-node
does not load files
, include
and exclude
from tsconfig.json
on startup by default.
https://github.com/TypeStrong/ts-node#help-my-types-are-missing