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

TypeError from Deno >= 1.5.1 #8355

Closed
oscarotero opened this issue Nov 11, 2020 · 8 comments
Closed

TypeError from Deno >= 1.5.1 #8355

oscarotero opened this issue Nov 11, 2020 · 8 comments
Assignees
Labels
bug Something isn't working cli related to cli/ dir needs investigation requires further investigation before determining if it is an issue or not

Comments

@oscarotero
Copy link

Hi.
We have a port of postcss to Deno here: https://github.com/postcss/postcss-deno/tree/master/deno
The code is converted automatically so it keeps synced with the original repository.
From Deno 1.5.1 and upper, we are getting the following error on make the conversion and running the tests:
https://github.com/postcss/postcss/runs/1380656312?check_suite_focus=true#step:5:185

Check file:///home/runner/work/postcss/postcss/$deno$test.ts
error: TypeError: Cannot read property 'kind' of undefined
    at Object.isEntityNameExpression (deno:cli/tsc/00_typescript.js:17115:21)
    at serializeMaybeAliasAssignment (deno:cli/tsc/00_typescript.js:48356:42)
    at serializeSymbolWorker (deno:cli/tsc/00_typescript.js:47874:49)
    at serializeSymbol (deno:cli/tsc/00_typescript.js:47825:38)
    at deno:cli/tsc/00_typescript.js:47800:25
    at Map.forEach (<anonymous>)
    at visitSymbolTable (deno:cli/tsc/00_typescript.js:47799:33)
    at serializeAsNamespaceDeclaration (deno:cli/tsc/00_typescript.js:48162:25)
    at serializeModule (deno:cli/tsc/00_typescript.js:48071:25)
    at serializeSymbolWorker (deno:cli/tsc/00_typescript.js:47949:25)

The code works fine in Deno 1.5.0. It seems like a Typescript error but I couldn't find anything wrong in the code.
Any hint?

@kitsonk
Copy link
Contributor

kitsonk commented Nov 11, 2020

It is an internal TypeScript error of some sort. The challenge seems that it looks like it is only raised when there is an internal in memory module we are generating for the tests. Will need to do a bit of investigation to narrow down why it is occurring.

@kitsonk kitsonk added bug Something isn't working cli related to cli/ dir needs investigation requires further investigation before determining if it is an issue or not labels Nov 11, 2020
@oscarotero
Copy link
Author

Ok, thank you for the quick reply. Yes, it seems something related with testing.

@andreubotella
Copy link
Contributor

andreubotella commented Nov 24, 2020

This isn't a testing-related bug; here's a minimal test case that can be run with deno run:

// This must be a .ts file run from `deno run`
import "./dep.js";
// dep.js
class CssSyntaxError extends Error {}

CssSyntaxError.default = CssSyntaxError;

@kitsonk kitsonk self-assigned this Nov 24, 2020
@kitsonk
Copy link
Contributor

kitsonk commented Nov 24, 2020

It is a testing related bug. Just because one test case works, doesn't mean there isn't a bug. 😁

@andreubotella
Copy link
Contributor

andreubotella commented Nov 24, 2020

I meant that it isn't a testing-related bug because the error shows up in the above test case even when running deno run, rather than deno test. The fact that on postcss-deno non-test runs don't reach the conditions that cause the bug doesn't make it a testing bug.

@kitsonk
Copy link
Contributor

kitsonk commented Nov 24, 2020

Ah, ok, thanks for isolating it a bit better. I mis-read your comment. I thought you were point out it as I mis-understood "minimal test case" implied "minimal reproduction".

@oscarotero
Copy link
Author

Yes, I can confirm that this is the cause of the error.
After removing this code in the Deno conversion (here https://github.com/postcss/postcss-deno/blob/master/to_deno.js#L29) the build works fine now.

In theory, this change would provide better support for typescript (postcss/postcss#1459)

@oscarotero
Copy link
Author

It seems like the latest version of Deno fixes this error, so I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli related to cli/ dir needs investigation requires further investigation before determining if it is an issue or not
Projects
None yet
Development

No branches or pull requests

3 participants