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
Create TypeScript definitions #4399
Comments
I don't think we need a separate issue for this. Upgrade would be handled as with any other dependency. |
This issue was not about upgrade at first place, It is about creating definitions =) |
Then rename it and explain a little bit more in the first comment :) |
This is neat. It's great to see JSDocs TypeScript getting some love. |
With #4245 now closed, I'm removing the '"blocked" label. |
Currently it's blocked by #4505 |
Hi. |
@tyankatsu0105 we use TypeScript to avoid bugs in our code Line 44 in 6cfea29
|
@hudochenkov |
Right. But we want to expose them in future, so plugin developers could use them. That's why we have this issue. |
Awesome!!! Thanks for the reply @hudochenkov :) |
I tried this now, and most of the declaration files appear to be generated, but there are at least two issues:
This looks like a generated file, so it probably can't be edited. Possibly related to microsoft/TypeScript#37832 or microsoft/TypeScript#38382.
Multiple declaration files have code like this: export = _exports; ... with the error: I couldn't find an existing TypeScript issue regarding this error, but other projects have run into this as well it seems. You can test it yourself by adding the following to "declaration": true,
"emitDeclarationOnly": true,
"outDir": "types-new" (and optionally removing Then run |
* Replace 3rd-party type definitions This change replaces 3rd-party type definitions under the `types/` directory with the following `@types/*` npm packages. - [@types/balanced-match](https://www.npmjs.com/package/@types/balanced-match) - [@types/imurmurhash](https://www.npmjs.com/package/@types/imurmurhash) - [@types/postcss-safe-parser](https://www.npmjs.com/package/@types/postcss-safe-parser) - [@types/style-search](https://www.npmjs.com/package/@types/style-search) - [@types/svg-tags](https://www.npmjs.com/package/@types/svg-tags) - [@types/write-file-atomic](https://www.npmjs.com/package/@types/write-file-atomic) Note that this change does **not** replace all type definitions under `types/`. We should address the remaining types via other pull requests. Related to #4399 * Replace with `@types/file-entry-cache`
This is a part of #4399. This change installs the type definition `@types/table` of the `table` package. The package is used in `lib/formatters/stringFormatter.js`: https://github.com/stylelint/stylelint/blob/cecacb9d4fe3b5bae5f264efa6e60c414a0f4946/lib/formatters/stringFormatter.js#L8 See also: - https://www.npmjs.com/package/table - https://www.npmjs.com/package/@types/table
This change adds a type definition for the `postcss-syntax` package. To find the definition easily, this extracts a new file from the `types/postcss/index.d.ts` file. Note that there is no `@types/postcss-syntax` package. (see <https://www.npmjs.com/search?q=%40types%2Fpostcss-syntax>) Here is a main source of the package: https://github.com/gucong3000/postcss-syntax/blob/v0.36.2/index.js Also, `postcss-syntax` is used only in `lib/getPostcssResult.js`: https://github.com/stylelint/stylelint/blob/cecacb9d4fe3b5bae5f264efa6e60c414a0f4946/lib/getPostcssResult.js#L64-L75 This is a part of #4399.
Any progress on this? It really sucks that there are only outdated types available. I may help if someone describes the current status to me... |
The last attempt (#4399 (comment)) to do this was a year ago and some issues were encountered. Things may have improved since then. So, if you've time you're welcome to look into it. It would be amazing to resolve as TypeScript usage has exploded. |
Apart from the 2 issues previously mentioned (which still exist – perhaps related to microsoft/TypeScript#41672), there is also an issue in
|
@glen-84 About #4399 (comment), I've opened the issue to But, to fix the TS error, it seems that we could just specify a module ID as below: - compact: importLazy(() => require('./compactFormatter'))(),
+ compact: importLazy(() => require('./compactFormatter'))('compactFormatter'), |
@ybiquitous Is stylelint even being bundled in the first place? |
Given types exist in https://github.com/stylelint/stylelint/tree/master/types/stylelint, couldn't these be exposed in the |
I've requested to remove the |
There is a killer feature for stylelint in TypeScript 3.7 - now it possible to create declaration file from JS https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#--declaration-and---allowjs
Blocked by: #4245
The text was updated successfully, but these errors were encountered: