Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

SubmitLinkOptions type declaration marks subredditName as non-optional, but is autofilled in javascript source #358

Open
jamesrswift opened this issue Apr 3, 2022 · 1 comment

Comments

@jamesrswift
Copy link

subredditName: string;

Marked without optional qualifier, however, in the javascript source, this member is autofilled to be equal to the parent object's display name:

  submitLink(options) {
    return this._r.submitLink(_objectSpread({}, options, {
      subredditName: this.display_name
    }));
  }
@iMrDJAi
Copy link

iMrDJAi commented Apr 5, 2022

Nice catch! The interface SubmitLinkOptions is meant to be for snoowrap#submitLink and not Subreddit#submitLink. That means the shortcuts for the submit functions on the Subreddit class need separate interfaces. Probably it's enough to just use Omit:

submitLink (options: Omit<SubmitLinkOptions, 'subredditName'>) {
  return this._r.submitLink({...options, subredditName: this.display_name})
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants