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

Typecheck fails for Architect create-remix-app template #6296

Closed
1 task done
lpsinger opened this issue May 3, 2023 · 10 comments
Closed
1 task done

Typecheck fails for Architect create-remix-app template #6296

lpsinger opened this issue May 3, 2023 · 10 comments
Assignees
Labels

Comments

@lpsinger
Copy link
Contributor

lpsinger commented May 3, 2023

What version of Remix are you using?

1.16.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

  1. Create an app using create-remix.
  2. Select Just the basics, (AWS Lambda), TypeScript, and let it run npm install.
  3. Descend into the newly created my-remix-app directory directory and run npm run typecheck.

Expected Behavior

TypeScript type checks should complete without any errors.

Actual Behavior

$ npx create-remix@latest
? Where would you like to create your app? ./my-remix-app
? What type of app do you want to create? Just the basics
? Where do you want to deploy? Choose Remix App Server if you're unsure; it's 
easy to change deployment targets. Architect (AWS Lambda)
? TypeScript or JavaScript? TypeScript
? Do you want me to run `npm install`? Yes
⠦ Creating your app…(⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠏ idealTree:my-remix-app: sill idealTrenpm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

added 1287 packages, and audited 1288 packages in 19s

279 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
💿 That's it! `cd` into "/private/tmp/my-remix-app" and check the README for development and deploy instructions!
$ cd my-remix-app/
$ npm run typecheck

> typecheck
> tsc

node_modules/@remix-run/architect/dist/server.d.ts:3:135 - error TS2307: Cannot find module 'aws-lambda' or its corresponding type declarations.

3 import type { APIGatewayProxyEventHeaders, APIGatewayProxyEventV2, APIGatewayProxyHandlerV2, APIGatewayProxyStructuredResultV2 } from "aws-lambda";
                                                                                                                                        ~~~~~~~~~~~~

node_modules/@remix-run/node/dist/upload/fileUploadHandler.d.ts:47:22 - error TS2420: Class 'NodeOnDiskFile' incorrectly implements interface 'File'.
  Property 'prototype' is missing in type 'NodeOnDiskFile' but required in type 'File'.

47 export declare class NodeOnDiskFile implements File {
                        ~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:2591:5
    2591     prototype: Blob;
             ~~~~~~~~~
    'prototype' is declared here.

node_modules/@remix-run/server-runtime/dist/cookies.d.ts:1:65 - error TS7016: Could not find a declaration file for module 'cookie'. '/private/tmp/my-remix-app/node_modules/@remix-run/server-runtime/node_modules/cookie/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/cookie` if it exists or add a new declaration (.d.ts) file containing `declare module 'cookie';`

1 import type { CookieParseOptions, CookieSerializeOptions } from "cookie";
                                                                  ~~~~~~~~

node_modules/@remix-run/server-runtime/dist/sessions.d.ts:1:65 - error TS7016: Could not find a declaration file for module 'cookie'. '/private/tmp/my-remix-app/node_modules/@remix-run/server-runtime/node_modules/cookie/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/cookie` if it exists or add a new declaration (.d.ts) file containing `declare module 'cookie';`

1 import type { CookieParseOptions, CookieSerializeOptions } from "cookie";
                                                                  ~~~~~~~~

node_modules/@types/glob/index.d.ts:29:42 - error TS2694: Namespace '"/private/tmp/my-remix-app/node_modules/minimatch/dist/cjs/index"' has no exported member 'IOptions'.

29     interface IOptions extends minimatch.IOptions {
                                            ~~~~~~~~

node_modules/@types/glob/index.d.ts:74:30 - error TS2724: '"/private/tmp/my-remix-app/node_modules/minimatch/dist/cjs/index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?

74         minimatch: minimatch.IMinimatch;
                                ~~~~~~~~~~


Found 6 errors in 5 files.

Errors  Files
     1  node_modules/@remix-run/architect/dist/server.d.ts:3
     1  node_modules/@remix-run/node/dist/upload/fileUploadHandler.d.ts:47
     1  node_modules/@remix-run/server-runtime/dist/cookies.d.ts:1
     1  node_modules/@remix-run/server-runtime/dist/sessions.d.ts:1
     2  node_modules/@types/glob/index.d.ts:29
$ 
@lpsinger
Copy link
Contributor Author

lpsinger commented May 4, 2023

#6275 is related, but there are a number of other problems evident here too --- several of them traceable to #6051.

@dani-mp
Copy link

dani-mp commented May 23, 2023

Is there a workaround for this? I'm having the same problem in Vercel when I try to upgrade my Remix app to 1.16.X.

@machour
Copy link
Collaborator

machour commented May 23, 2023

Related (duplicate?) of #4371 but for yet another template

lpsinger added a commit to lpsinger/remix that referenced this issue May 23, 2023
@MichaelDeBoey
Copy link
Member

Also related to #6244

@quangv
Copy link

quangv commented May 27, 2023

Believe it's also related to #6403

@lpsinger
Copy link
Contributor Author

lpsinger commented Jun 6, 2023

This is still broken in 1.17.0: "just the basics" projects created from the create-remix template still fail type checks. Is there anything that I can do to help move this along to a fix for these typecheck bugs that were introduced by #6051? #5713, #6464, and #6403 are all options that at least partially solve the problem. What would the maintainers like to do here? Would a PR to revert #6051 be considered?

lpsinger added a commit to lpsinger/remix that referenced this issue Jun 14, 2023
The `@remix-run/architect` package exports types that depend upon
`@types/aws-lambda`, so it needs to depend (not devDepend) on it.

This will fix the following error that occurs on a freshly
bootstrapped Architect project generated with create-remix:

```
r$ npm run typecheck

> typecheck
> tsc

node_modules/@remix-run/architect/dist/server.d.ts:3:135 - error TS2307: Cannot find module 'aws-lambda' or its corresponding type declarations.

3 import type { APIGatewayProxyEventHeaders, APIGatewayProxyEventV2, APIGatewayProxyHandlerV2, APIGatewayProxyStructuredResultV2 } from "aws-lambda";
                                                                                                                                        ~~~~~~~~~~~~
```

See https://stackoverflow.com/a/46011417/167694.

Addresses part of remix-run#6296.
lpsinger added a commit to lpsinger/remix that referenced this issue Jun 14, 2023
The `@remix-run/architect` package exports types that depend upon
`@types/aws-lambda`, so it needs to depend (not devDepend) on it.

This will fix the following error that occurs on a freshly
bootstrapped Architect project generated with create-remix:

```
$ npm run typecheck

> typecheck
> tsc

node_modules/@remix-run/architect/dist/server.d.ts:3:135 - error TS2307: Cannot find module 'aws-lambda' or its corresponding type declarations.

3 import type { APIGatewayProxyEventHeaders, APIGatewayProxyEventV2, APIGatewayProxyHandlerV2, APIGatewayProxyStructuredResultV2 } from "aws-lambda";
                                                                                                                                        ~~~~~~~~~~~~
```

See https://stackoverflow.com/a/46011417/167694.

Addresses part of remix-run#6296.
@brophdawg11 brophdawg11 added the awaiting release This issue has been fixed and will be released soon label Jun 15, 2023
lpsinger added a commit to lpsinger/remix that referenced this issue Jun 16, 2023
Fixes this TypeScript error on newly initialized Remix projects:

```
node_modules/@types/glob/index.d.ts:29:42 - error TS2694: Namespace '"/private/tmp/my-remix-app/node_modules/minimatch/dist/cjs/index"' has no exported member 'IOptions'.

29     interface IOptions extends minimatch.IOptions {
                                            ~~~~~~~~

node_modules/@types/glob/index.d.ts:74:30 - error TS2724: '"/private/tmp/my-remix-app/node_modules/minimatch/dist/cjs/index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?

74         minimatch: minimatch.IMinimatch;
                                ~~~~~~~~~~
```

Partially addresses remix-run#6296.
@MichaelDeBoey
Copy link
Member

This is now fixed by #6108 and will be released in v2

MichaelDeBoey pushed a commit to lpsinger/remix that referenced this issue Aug 8, 2023
@tommyasai
Copy link

V2 release has fixed some errors but didn't fix the following two errors. Does anyone see the same issue?

There's a StackOverflow discussion that addresses this issue, but I am not sure how to resolve it in my project.

node_modules/@types/glob/index.d.ts:29:42 - error TS2694: Namespace '"/private/tmp/my-remix-app/node_modules/minimatch/dist/cjs/index"' has no exported member 'IOptions'.

29     interface IOptions extends minimatch.IOptions {
                                            ~~~~~~~~

node_modules/@types/glob/index.d.ts:74:30 - error TS2724: '"/private/tmp/my-remix-app/node_modules/minimatch/dist/cjs/index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?

74         minimatch: minimatch.IMinimatch;

@MichaelDeBoey
Copy link
Member

MichaelDeBoey commented Sep 6, 2023

@tommyasai That error is fixed by #7317 and is available in the latest pre-release

@tommyasai
Copy link

@MichaelDeBoey Confirmed it works. I was using 2.0.0-pre.3. Thank you.

@brophdawg11 brophdawg11 removed the awaiting release This issue has been fixed and will be released soon label Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants