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

Uncaught TypeError in Getting Started guide #302

Closed
ajcwebdev opened this issue May 7, 2021 · 23 comments
Closed

Uncaught TypeError in Getting Started guide #302

ajcwebdev opened this issue May 7, 2021 · 23 comments

Comments

@ajcwebdev
Copy link

Hello Aleph.js team 👋. I was recently updating my blog post about Aleph and found that I was getting an error when following along with the current Getting Started guide. All three aleph commands, dev, start, and build result in the same error.

Commands entered:

deno install --unstable -A -f -n aleph https://deno.land/x/aleph@v0.2.28/cli.ts
export PATH="/Users/ajcwebdev/.deno/bin:$PATH"
aleph init hello
cd hello
aleph dev

Error output:

Check https://deno.land/x/aleph@v0.2.28/cli/dev.ts

error: Uncaught (in promise) TypeError: TS2345 [ERROR]: Argument of type 'TransformerFactory<SourceFile>' is not assignable to parameter of type 'TransformerFactory<SourceFile> | CustomTransformerFactory'.
  Type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").TransformerFactory<import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").SourceFile>' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").TransformerFactory<import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").SourceFile>'.
    Types of parameters 'context' and 'context' are incompatible.
      Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").TransformationContext' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").TransformationContext'.
        The types of 'factory.createTypeParameterDeclaration(...).parent' are incompatible between these types.
          Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").DeclarationWithTypeParameterChildren | import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").InferTypeNode' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").DeclarationWithTypeParameterChildren | import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").InferTypeNode'.
            Type 'JSDocTemplateTag' is not assignable to type 'DeclarationWithTypeParameterChildren | InferTypeNode'.
              Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDocTemplateTag' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDocTemplateTag'.
                Types of property 'parent' are incompatible.
                  Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDoc | import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDocTypeLiteral' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDoc | import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDocTypeLiteral'.
                    Type 'JSDoc' is not assignable to type 'JSDoc | JSDocTypeLiteral'.
                      Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDoc' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDoc'.
                        Types of property 'parent' are incompatible.
                          Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").HasJSDoc' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").HasJSDoc'.
                            Type 'ImportEqualsDeclaration' is not assignable to type 'HasJSDoc'.
                              Property 'isTypeOnly' is missing in type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").ImportEqualsDeclaration' but required in type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").ImportEqualsDeclaration'.
    if (reactRefresh) transformers.before!.push(reactRefreshTS())
                                                ~~~~~~~~~~~~~~~~
    at https://deno.land/x/aleph@v0.2.28/tsc/compile.ts:28:49

    'isTypeOnly' is declared here.
            readonly isTypeOnly: boolean;
                     ~~~~~~~~~~
        at https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts:1601:18
    const { default: cmd } = await import(`./cli/${command}.ts`)
                             ^
    at async main (https://deno.land/x/aleph@v0.2.28/cli.ts:163:30)

Aleph version

aleph.js v0.2.28

Deno version

deno 1.8.0

deno info

DENO_DIR location: "/Users/ajcwebdev/Library/Caches/deno"
Remote modules cache: "/Users/ajcwebdev/Library/Caches/deno/deps"
TypeScript compiler cache: "/Users/ajcwebdev/Library/Caches/deno/gen"

My system info

System Version: macOS 11.3 (20E232)
Kernel Version: Darwin 20.4.0
Boot Volume: Macintosh HD

Hopefully that's helpful, let me know if you need other system info or anything like that.

@augustomallmann
Copy link

I have the exact same issue with same system info (mac os 11.3.1)

@shadowtime2000
Copy link
Member

This isn't a bug looking more into it. afaik 0.2.28 is not compatable with any newer Deno versions and only works with Deno 1.6.x. If you want to use Deno 1.8.0 use the latest alpha version of Aleph.

@augustomallmann
Copy link

augustomallmann commented May 9, 2021

I downgraded deno version to 1.6.3 and the error persists:

 deno --version
deno 1.6.3 (release, x86_64-apple-darwin)
v8 8.8.294
typescript 4.1.3
augustomallmann in ~ 
❯ aleph init test 
Check https://deno.land/x/aleph@v0.2.28/cli/init.ts
INFO Downloading template...
INFO Saving template...
INFO Done
INFO ---
INFO Aleph.js is ready to Go.
INFO $ cd test
INFO $ aleph dev    # start the app in `development` mode
INFO $ aleph start  # start the app in `production` mode
INFO $ aleph build  # build the app to a static site (SSG)
INFO ---
augustomallmann in ~ took 5s 
❯ cd test && aleph dev
Check https://deno.land/x/aleph@v0.2.28/cli/dev.ts
error: Uncaught (in promise) TypeError: TS2345 [ERROR]: Argument of type 'TransformerFactory<SourceFile>' is not assignable to parameter of type 'TransformerFactory<SourceFile> | CustomTransformerFactory'.
  Type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").TransformerFactory<import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").SourceFile>' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").TransformerFactory<import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").SourceFile>'.
    Types of parameters 'context' and 'context' are incompatible.
      Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").TransformationContext' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").TransformationContext'.
        The types of 'factory.createTypeParameterDeclaration(...).parent' are incompatible between these types.
          Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").CallSignatureDeclaration | import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").ConstructSignatureDeclaration | ... 17 more ... | import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").InferTypeNode' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").CallSignatureDeclaration | import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").ConstructSignatureDeclaration | ... 17 more ... | import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").InferTypeNode'.
            Type 'JSDocTemplateTag' is not assignable to type 'CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | ArrowFunction | ... 15 more ... | InferTypeNode'.
              Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDocTemplateTag' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDocTemplateTag'.
                Types of property 'parent' are incompatible.
                  Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDoc | import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDocTypeLiteral' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDoc | import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDocTypeLiteral'.
                    Type 'JSDoc' is not assignable to type 'JSDoc | JSDocTypeLiteral'.
                      Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDoc' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDoc'.
                        Types of property 'parent' are incompatible.
                          Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").HasJSDoc' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").HasJSDoc'.
                            Type 'ImportEqualsDeclaration' is not assignable to type 'HasJSDoc'.
                              Property 'isTypeOnly' is missing in type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").ImportEqualsDeclaration' but required in type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").ImportEqualsDeclaration'.
    if (reactRefresh) transformers.before!.push(reactRefreshTS())
                                                ~~~~~~~~~~~~~~~~
    at https://deno.land/x/aleph@v0.2.28/tsc/compile.ts:28:49

    'isTypeOnly' is declared here.
            readonly isTypeOnly: boolean;
                     ~~~~~~~~~~
        at https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts:1601:18

@augustomallmann
Copy link

@ajcwebdev did you fix the issue on your side? If yes, could you please share what you've done?

@ajcwebdev
Copy link
Author

Hey @augustomallmann, unfortunately I have not had time to debug, been busy with work. I'm not sure if anyone on the Aleph team is in the Deno Discord but you could probably get some assistance there.

@shadowtime2000
Copy link
Member

It seems then that this is an issue with esm.sh then, though i don't know for sure (cc @ije)

PS: you can also join the aleph discord server for help, but I am also in the deno discord server if you need help with stuff

@elycheikhsmail
Copy link

I think it's to strict typescript check, type any not allowed any more then we must type returned value of each function/method

@thesabbir
Copy link

Same error on a fresh project:

Check https://deno.land/x/aleph@v0.2.28/cli/dev.ts
error: Uncaught (in promise) TypeError: TS2345 [ERROR]: Argument of type 'TransformerFactory<SourceFile>' is not assignable to parameter of type 'TransformerFactory<SourceFile> | CustomTransformerFactory'.
  Type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").TransformerFactory<import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").SourceFile>' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").TransformerFactory<import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").SourceFile>'.
    Types of parameters 'context' and 'context' are incompatible.
      Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").TransformationContext' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").TransformationContext'.
        The types of 'factory.createTypeParameterDeclaration(...).parent' are incompatible between these types.
          Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").DeclarationWithTypeParameterChildren | import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").InferTypeNode' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").DeclarationWithTypeParameterChildren | import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").InferTypeNode'.
            Type 'JSDocTemplateTag' is not assignable to type 'DeclarationWithTypeParameterChildren | InferTypeNode'.
              Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDocTemplateTag' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDocTemplateTag'.
                Types of property 'parent' are incompatible.
                  Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDoc | import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDocTypeLiteral' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDoc | import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDocTypeLiteral'.
                    Type 'JSDoc' is not assignable to type 'JSDoc | JSDocTypeLiteral'.
                      Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").JSDoc' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").JSDoc'.
                        Types of property 'parent' are incompatible.
                          Type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").HasJSDoc' is not assignable to type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").HasJSDoc'.
                            Type 'ImportEqualsDeclaration' is not assignable to type 'HasJSDoc'.
                              Property 'isTypeOnly' is missing in type 'import("https://cdn.esm.sh/v41/typescript@4.1.2/lib/typescript.d.ts").ImportEqualsDeclaration' but required in type 'import("https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts").ImportEqualsDeclaration'.
    if (reactRefresh) transformers.before!.push(reactRefreshTS())
                                                ~~~~~~~~~~~~~~~~
    at https://deno.land/x/aleph@v0.2.28/tsc/compile.ts:28:49

    'isTypeOnly' is declared here.
            readonly isTypeOnly: boolean;
                     ~~~~~~~~~~
        at https://cdn.esm.sh/v41/typescript@4.2.4/lib/typescript.d.ts:1601:18
    const { default: cmd } = await import(`./cli/${command}.ts`)
                             ^
    at async main (https://deno.land/x/aleph@v0.2.28/cli.ts:163:30)


@thesabbir
Copy link

thesabbir commented May 27, 2021

With 0.33-alpha

aleph dev
INFO Start watching code changes...
INFO Server ready on http://localhost:8080/
INFO render '/' in 88ms
ERROR invoke API: ReferenceError: Access to "location", run again with --location <href>.
    at get (deno:extensions/web/12_location.js:365:17)
    at createStorage (deno:extensions/webstorage/01_webstorage.js:91:28)
    at localStorage (deno:extensions/webstorage/01_webstorage.js:178:24)
    at handler (file:///Users/user/app/.aleph/development/api/counter/index.js#9786cc:2:28)
    at Server.handle (https://deno.land/x/aleph@v0.3.0-alpha.33/server/server.ts:189:21)
^C

@AzrizHaziq
Copy link

Hi, I just tried using this framework in case if you are also in the same boat, please upgrade your aleph version to aleph.js v0.3.0-alpha.33 and then use $ aleph init my-folder.

I forgot which command to upgrade my aleph version tho try $ aleph --help

@AzrizHaziq
Copy link

With 0.33-alpha

aleph dev
INFO Start watching code changes...
INFO Server ready on http://localhost:8080/
INFO render '/' in 88ms
ERROR invoke API: ReferenceError: Access to "location", run again with --location <href>.
    at get (deno:extensions/web/12_location.js:365:17)
    at createStorage (deno:extensions/webstorage/01_webstorage.js:91:28)
    at localStorage (deno:extensions/webstorage/01_webstorage.js:178:24)
    at handler (file:///Users/user/app/.aleph/development/api/counter/index.js#9786cc:2:28)
    at Server.handle (https://deno.land/x/aleph@v0.3.0-alpha.33/server/server.ts:189:21)
^C

Hi @thesabbir, have you found a solution for this? Thanks in advance

@shadowtime2000
Copy link
Member

@ije Do you think we could include this in the first 0.3 beta?

@scally
Copy link

scally commented May 29, 2021

I found a potential fix for deno 1.10 / aleph 0.3.0-alpha.33 :

I reinstalled aleph 0.3.0-alpha.33 with an additional dummy --location flag, like this:

deno install --location=http://localhost --unstable -A -f -n aleph https://deno.land/x/aleph@v0.3.0-alpha.33/cli.ts

And it finally worked -- localStorage is finally operational.

@thesabbir
Copy link

Documentation is way behind on things. @scally good job!

@shadowtime2000
Copy link
Member

Documentation is way behind on things

@thesabbir I would like to point out that the doc is purposely not updated with alpha stuff, well, because its alpha and super unstable compared to 0.2.28.

@scally Awesome!

@ajcwebdev
Copy link
Author

I think most people who are going to be finding the getting started guide are going to be on a recent version of Deno and are going to assume that they can just run the commands and get started. If this is not the case there should be more thorough instructions to get your dev environment setup.

@shadowtime2000
Copy link
Member

@ajcwebdev No offense to them, but they are probably rushing then and not paying attention to the documentation since its still clearly listed that the Deno version to use 1.6.3

image

@ajcwebdev
Copy link
Author

Most Node developers use tools like NVM to handle their Node versioning, is there a similar tool for Deno? How would you get onto Deno 1.6.3?

@shadowtime2000
Copy link
Member

@ajcwebdev You would just downgrade to Deno 1.6.3. There isn't any tool afaik that can do something like nvm, you would just have to downgrade to Deno 1.6.3 if you want to use the latest somewhat stable Aleph version.

@ajcwebdev
Copy link
Author

Cool, thanks for the info @shadowtime2000! 👍

Haven't tried it yet but it looks like there is in fact a dvm.

@ganondev
Copy link

I know this issue was closed, but I feel like most people would assume that a minor version difference wouldn't cause a breaking discrepancy like this. Is the necessity for the --location option something introduced in one of the deno upgrades, or was there some change in aleph.js that made it necessary but can be potentially rectified? Same thing for the compilation error in the OP. I wouldn't expect, for example, that a minor version upgrade in Maven would cause my Spring server to suddenly need to be reinstalled with different parameters due to some runtime classloader error.
Alternatively, is this perhaps an unintentional break and therefore technically a bug in Deno, for which an issue needs to be opened there? The issue of the location requirement at least persists into deno 1.12.0.

@shadowtime2000
Copy link
Member

@ganondev

I wouldn't expect, for example, that a minor version upgrade in Maven would cause my Spring server to suddenly need to be reinstalled with different parameters due to some runtime classloader error.

The reason you wouldn't expect that is that Maven is (iirc) stable.

Aleph.js is not. We are in the early stages of the project, and so it should be expected that breaking changes will come.

Idk if you would really consider this even technically a bug in Deno because it seems to be kind of expected with requiring a --location flag for local storage use.

Lmk what you think though.

@ganondev
Copy link

@shadowtime2000

Aleph.js is not. We are in the early stages of the project, and so it should be expected that breaking changes will come.

I figured this would come up and I can accept that. However, I really meant for Maven to be the analogue of Deno, while Spring would be the analogue of Aleph.js. I meant to convey that I find it strange that a Deno minor increment would break the 'Getting Started' workflow as documented for Aleph.js.

However, reading through the issues around the --location option for Deno, it occurs to me that the fact that its addition had some backwards-compatibility issues was already reported at the time of Deno 1.7.0. It doesn't seem to me that they intend to recognize the breaking nature of that addition. With that sentiment, I suppose I'll drop off this issue. I figure it won't have a long-term effect in any case.

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

No branches or pull requests

8 participants