Definitelytyped: [@types/prettier] Plugin.options seems to be fundamentally different from what Prettier expects

Created on 15 Sep 2020  路  7Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [x] I tried using the @types/prettier package and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @ikatyang @ifiokjr @ffflorian @sosukesuzuki


https://github.com/DefinitelyTyped/DefinitelyTyped/blob/71edd1752d07111dff93a2c81deb2a4c41dccb0e/types/prettier/index.d.ts#L166

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/71edd1752d07111dff93a2c81deb2a4c41dccb0e/types/prettier/index.d.ts#L332-L345


Prettier common example: https://github.com/prettier/prettier/blob/810325daf685173f5f43e7ad1ac7603c4687a6d1/src/common/common-options.js

Plugin example: https://github.com/prettier/plugin-pug/blob/c2dcc5729b89423ee13fa4bee583024cb3fcb682/src/options/index.ts#L67

All 7 comments

@fisker Can you tell me if SupportOption[] is even valid or if this is an outdated thing?
Can I therefore completely rewrite the definitions or do I have to support this array variant as well?

I'm sorry, I'm not familiar with this part. But I guess it should have something to do with vnopts.

@fisker Do you know who in prettier's core team could help here?

I'm just starting to explore prettier's code right now...

I think @ikatyang can help.

Ref: https://github.com/prettier/prettier/blob/e857c4e88ffbf0c2fb213ee7172fbe9431ab87a8/src/main/support.js#L36

It's implemented using arrays internally, but the external interfaces are objects. Didn't remember why I wrote it this way. 馃槄

@ikatyang So the declarations are indeed just wrong?

I currently need to use as any here

https://github.com/prettier/plugin-pug/blob/c2dcc5729b89423ee13fa4bee583024cb3fcb682/src/index.ts#L102

Yes, it seems to be the case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jbreckmckye picture jbreckmckye  路  3Comments

jamespero picture jamespero  路  3Comments

JWT
svipas picture svipas  路  3Comments

variousauthors picture variousauthors  路  3Comments

csharpner picture csharpner  路  3Comments