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

TS warning when running with --typeCheck #10

Open
briancavalier opened this issue Apr 1, 2019 · 4 comments
Open

TS warning when running with --typeCheck #10

briancavalier opened this issue Apr 1, 2019 · 4 comments

Comments

@briancavalier
Copy link
Collaborator

I've started using @typed/test in @most/index, and just added the --typeCheck flag to enable type checking when running tests. That yielded a type warning that doesn't seem like it should happen:

➜ npm test

> @most/[email protected] test /Users/brian/Projects/cujojs/@most/index
> typed-test --typeCheck 'src/**/*.test.ts'

Running tests...
Typechecking...
Typechecking complete.
/Users/brian/Projects/cujojs/@most/index/Users/brian/Projects/cujojs/@most/index/node_modules/@typed/test/lib/results/resultToDom.d.ts (2,62):
  Cannot find name 'HTMLElement'.
/Users/brian/Projects/cujojs/@most/index/Users/brian/Projects/cujojs/@most/index/node_modules/@typed/test/lib/results/resultToDom.d.ts (3,76):
  Cannot find name 'HTMLElement'.

The project isn't specifically using any DOM-related. The path in the error message looks like it's been double-absolute-ized as well. The tests still run successfully, so it's not a blocker.

Any ideas what's going on?

@Frikki
Copy link
Collaborator

Frikki commented Apr 2, 2019

@typed/test is able to run browser tests and uses the HTMLElement here and here.

There are two workarounds that I know of:

  1. add "dom" to the list of libraries in tsconfig.json, or
  2. split the tsconfig in two or more files as described here.

@TylorS
Copy link
Owner

TylorS commented Apr 2, 2019

@briancavalier Thanks for bug report - I feel issue is a leaking of @typed/test's requirement for dom to be in your lib configuration of your tsconfig.json. The fix may be similar to that of #9 where I should auto-add the requirement for dom to the parsed compiler options. What do you guys think?

@briancavalier
Copy link
Collaborator Author

briancavalier commented Apr 2, 2019

That seems pretty reasonable, @TylorS. In my mind, an ideal end result would be:

  1. Users of @typed/test only specify what their project needs in tsconfig.json. IOW, they can use the same tsconfig.json when they use @typed/test as they would if they weren't using it.
  2. In that scenario, @typed/test does whatever it needs to do (auto-adding options, etc.) to ensure that tests can be run in node and/or browser with no surprises.

Does that line up with what you're thinking?

@TylorS
Copy link
Owner

TylorS commented Apr 2, 2019

Yes - spot on. I really want to avoid situations where @typed/test imposes arbitrary configuration changes on you

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

3 participants