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

Options type missing in prettyDOM function #308

Closed
thomaslombart opened this issue Jul 8, 2019 · 4 comments
Closed

Options type missing in prettyDOM function #308

thomaslombart opened this issue Jul 8, 2019 · 4 comments

Comments

@thomaslombart
Copy link

Problem description:

The options type of the prettyDOM function is missing in the typings.

Suggested solution:

Add the following types in typings/pretty-dom.d.ts

import {Options} from 'pretty-format'

export function prettyDOM(
  element: HTMLElement,
  maxLength?: number,
  options?: Options,
): string | false
@thomaslombart
Copy link
Author

thomaslombart commented Jul 8, 2019

I actually tried to add the missing types as described in the suggested solution and open a PR but I got a weird error during the pre-commit:

Error while linting prettyDOM types

I also got few errors while running dtslint:

Error: Errors in typescript@2.8 for external dependencies:
../node_modules/@babel/parser/typings/babel-parser.d.ts(11,64): error TS2304: Cannot find name 'import'.
../node_modules/@babel/parser/typings/babel-parser.d.ts(11,70): error TS1144: '{' or ';' expected.
../node_modules/@babel/parser/typings/babel-parser.d.ts(11,87): error TS2339: Property 'File' does not exist on type '"@babel/types"'.
../node_modules/@babel/parser/typings/babel-parser.d.ts(16,74): error TS2304: Cannot find name 'import'.
../node_modules/@babel/parser/typings/babel-parser.d.ts(16,80): error TS1144: '{' or ';' expected.
../node_modules/@babel/parser/typings/babel-parser.d.ts(16,97): error TS2339: Property 'Expression' does not exist on type '"@babel/types"'.
../node_modules/@types/yargs/index.d.ts(99,106): error TS2304: Cannot find name 'unknown'.
../node_modules/@types/yargs/index.d.ts(106,112): error TS2304: Cannot find name 'unknown'.
../node_modules/@types/yargs/index.d.ts(267,28): error TS2304: Cannot find name 'unknown'.
../node_modules/@types/yargs/index.d.ts(403,9): error TS2304: Cannot find name 'unknown'.

I couldn't figure out where do the errors come from. Do you have any idea?

@kentcdodds
Copy link
Member

I need to fix kcd-scripts to support TS files.

For now, go ahead and commit with --no-verify

@kentcdodds
Copy link
Member

If you rebase your changes with master, you shouldn't have this problem anymore.

@kentcdodds
Copy link
Member

Nevermind, this was already done in #309 😅

Thanks again!

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

2 participants