parse-community / node-apn

Apple Push Notification module for Node.js
Other
171 stars 61 forks source link

topic missing in type ProviderOptions #141

Open mathieulb opened 4 months ago

mathieulb commented 4 months ago

I had to do this when declaring ParseServerConfig in my app, because the topic field is missing :

declare module 'parse-server' {
  import type {ProviderOptions} from '@parse/node-apn'
  ...
  type ParseServerConfig = {
    ...
    push: {
      android: {senderId: string, apiKey: string},
      ios: (ProviderOptions & {topic?:string})[],
    }
    ...
  }
}
parse-github-assistant[bot] commented 4 months ago

Thanks for opening this issue!

mtrezza commented 4 months ago

Could you please add a full issue description?

mathieulb commented 4 months ago

There is no template for issues in this repo, unlike for the other parse repos I've submitted issues to, but this is purely a Typescript declaration issue, so, it can't have anything to do with my version of MongoDB.

I don't know what you need to know in addition to what I said. I am using @parse/node-apn 6.0.1 and I see that master branch of @parse/node-apn is also lacking this field in /index.d.ts.

mathieulb commented 4 months ago

In index.d.ts, in export interface ProviderOptions {...}, insert this line :

 topic?:string
mathieulb commented 4 months ago

Actually, sorry, topic isn't actually a field that goes there at that level. Like most Parse users, I'm configuring this through new ParseServer. Today I've searched parse, parse-server and @parse/node-apn for topic, push, ios and Provider, and didn't find anything relevant, then I realised that I hadn't searched @parse/push-adapter yet, and there it is. The problem I am trying to solve from the start, is to compensate for the lack of type declarations in parse-server, but in this case, the push section has a type that should be defined in @parse/push-adapter instead (a project that also has no type declarations).

mtrezza commented 4 months ago

Yes, only few repos have started converting to TS; please feel free to open an issue or PR in the respective repo.