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

[Request/Question] TypeScript definitions #23

Closed
Gounlaf opened this issue May 2, 2020 · 13 comments
Closed

[Request/Question] TypeScript definitions #23

Gounlaf opened this issue May 2, 2020 · 13 comments

Comments

@Gounlaf
Copy link

Gounlaf commented May 2, 2020

Hi,

Could you provide typescript definitions for your package?
Unfortunately I didn't found community definitions (on DefinitelyTyped/DefinitelyTyped), and I'm not enough skilled to create one (I can try but it would take time :x).

Thanks,

Regards.

@Gounlaf Gounlaf changed the title [Request] TypeScript definitions [Request/Question] TypeScript definitions May 2, 2020
@Raynos
Copy link
Owner

Raynos commented May 2, 2020

I might add tsdocstandard to this repo.

Please remind me in a few days :D

@Raynos
Copy link
Owner

Raynos commented May 3, 2020

I've started this in a PR #24

@Raynos
Copy link
Owner

Raynos commented May 5, 2020

I merged the PR that adds type definitions and released [email protected]

@Raynos Raynos closed this as completed May 5, 2020
@Gounlaf
Copy link
Author

Gounlaf commented May 6, 2020

Thanks !

@Gounlaf
Copy link
Author

Gounlaf commented May 9, 2020

Hi @Raynos,

I've installed version 10.3.0 but my IDE (WebStorm) is still complaining about not finding definitions (TS7016).
As a "provider" I understand you provide Types via tsdocstandard
As a "consumer" does I need to add something? (it might be not supported by WebStorm =/)

Thanks,

Regards.

@Raynos
Copy link
Owner

Raynos commented May 9, 2020

@Gounlaf

Can you share the tsconfig.json for your project ?

@Raynos
Copy link
Owner

Raynos commented May 9, 2020

Types are provided by typescript btw.

Tsdocstandard is just a linter that makes it easier to add jsdoc to a js library and write type definitions.

@Gounlaf
Copy link
Author

Gounlaf commented May 9, 2020

@Raynos sure, see below.

I use typescript 3.8.3 and also a minimal configuration of typescript-eslint

{
  "compilerOptions": {
    "target": "ES2019",
    "module": "commonjs",
    "sourceMap": true,
    "outDir": "./build",
    "strict": true,
    "noImplicitAny": true,
    "alwaysStrict": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "baseUrl": "./src",
    "paths": {
      "@i/*": ["i/*"],
      "@have/*": ["have/*"],
      "@some/*": ["some/*"],
      "@modules/*": ["modules/*"],
      "@alias/*": ["alias/*"]
    },
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  },
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "node_modules"
  ]
}

@Raynos
Copy link
Owner

Raynos commented May 10, 2020

It's quite frustrating that typescript does not type check the implementation of error.

I tried your tsconfig and added

  "include": [
    "src/**/*",
    "node_modules/error"
  ],

Basically telling typescript that node_modules/error exists and it started type checking properly.

However now i have build/node_modules/error ...

@Raynos
Copy link
Owner

Raynos commented May 10, 2020

@Raynos
Copy link
Owner

Raynos commented May 10, 2020

There's another important property in tsconfig.json

  "allowJs": true,

@Raynos
Copy link
Owner

Raynos commented May 10, 2020

Looks like another user found a similar workaround ( microsoft/TypeScript#33136 (comment) )

@Gounlaf
Copy link
Author

Gounlaf commented May 13, 2020

Hi,

Sorry for the delay.
Thanks for your answers; I still have not test yet, I will confirm here if it's OK with solution you gave me.

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