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

Remove explicit any types from the codebase #208

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Jan 7, 2022

This change removes all use of any from the code and updates the no-explicit-any eslint rule to be an error.

Resolves #201

This change removes all use of `any` from the code and updates the `no-explicit-any` eslint rule to be an error.
@changeset-bot
Copy link

changeset-bot bot commented Jan 7, 2022

🦋 Changeset detected

Latest commit: 479f3ff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR


type EventContext<Env, P extends string, Data> = {
request: Request;
waitUntil: (promise: Promise<any>) => void;
waitUntil: (promise: Promise<unknown>) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think waitUntil can return anything, so this should probably be void

Suggested change
waitUntil: (promise: Promise<unknown>) => void;
waitUntil: (promise: Promise<void>) => void;

Copy link
Member

Choose a reason for hiding this comment

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

It doesn't do anything with the return, but I can still return something if I choose.

Copy link
Member

Choose a reason for hiding this comment

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

waitUntil(Promise.resolve(5)) is totally valid.

@@ -1,14 +1,12 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import { match } from "path-to-regexp";
import type { HTTPMethod } from "./routes";

/* TODO: Grab these from @cloudflare/workers-types instead */
Copy link
Member

Choose a reason for hiding this comment

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

As I've said, I do hope to get rid of these entirely soon.

@threepointone threepointone merged commit fe4b099 into cloudflare:main Jan 7, 2022
@github-actions github-actions bot mentioned this pull request Jan 7, 2022
@petebacondarwin petebacondarwin deleted the remove-any branch January 19, 2022 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove explicit any type annotations in pages code
3 participants