Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typescript): aggregator-error imported properly #248

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/types.ts
@@ -1,4 +1,4 @@
import type AggregateError from "aggregate-error";
import AggregateError = require("aggregate-error");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the syntax recommended by the test action?
import * as ns from "mod"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying this approach I get the following error:
image

Also, trying import AggregateError from ... seems to be an issue:
image


The reason I was using import AggregateError = require() is because what I found in Typescript docs: https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require but not sure how to handle this.


Any ideas @wolfy1339

import type { RequestError } from "@octokit/request-error";

import type { EventNames } from "./generated/event-names";
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"esModuleInterop": true,
"module": "esnext",
"module": "commonjs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be targetting commonjs, Pika does that for us.

If you use the syntax i commented above, then you don't need to use the TS import = require()

"moduleResolution": "node",
"strict": true,
"target": "es2020",
Expand Down