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

constructor/method with a default initializer before a required argument errors out when publishing #23331

Closed
teidesu opened this issue Apr 12, 2024 · 0 comments · Fixed by #23356
Assignees
Labels
bug Something isn't working publish Related to "deno publish" subcommand

Comments

@teidesu
Copy link

teidesu commented Apr 12, 2024

mcve

// mod.ts
export class SortedArray {
  constructor(
      array: number[] = [],
      comparator: (a: number, b: number) => number,
  ) {
  }
}

then run deno publish --dry-run

happens on methods, too. not on normal functions, though.
type of the args doesn't matter much, just the fact that there is a default initializer

expected behaviour

the package publishes without errors

actual behaviour

errors out with:

error: Failed ensuring public API type output is valid.

TS1016 [ERROR]: A required parameter cannot follow an optional parameter.
  constructor(array?: number[], comparator: (a: number, b: number) => number){}
                                ~~~~~~~~~~
    at file:///Users/teidesu/repo/jsr/some-repro/baz/mod.ts:4:7

You may have discovered a bug in Deno. Please open an issue at: https://github.com/denoland/deno/issues/

version

deno 1.42.2 (release, aarch64-apple-darwin)
v8 12.3.219.9
typescript 5.4.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working publish Related to "deno publish" subcommand
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants