Skip to content

ts: fix TypeScript syntax for allowOutsideClick option#123

Merged
stefcameron merged 1 commit intofocus-trap:masterfrom
michael-ar:patch-1
Aug 12, 2020
Merged

ts: fix TypeScript syntax for allowOutsideClick option#123
stefcameron merged 1 commit intofocus-trap:masterfrom
michael-ar:patch-1

Conversation

@michael-ar
Copy link
Copy Markdown
Contributor

Recent PR contains invalid syntax for new option, this fixes.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Aug 12, 2020

💥 No Changeset

Latest commit: dddc8de

Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂

If these changes should be published to npm, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@stefcameron
Copy link
Copy Markdown
Member

@michael-ar Thanks for spotting that! TS is not my forte, though I would never have thought boolean | () => boolean was invalid syntax, but indeed it is.

@stefcameron stefcameron merged commit 8014984 into focus-trap:master Aug 12, 2020
@michael-ar michael-ar deleted the patch-1 branch August 13, 2020 08:07
@michael-ar
Copy link
Copy Markdown
Contributor Author

@stefcameron all good — I would have intuitively thought so too!

do you have any idea when the next npm release might happen? am currently installing directly from GitHub as I need one of the unreleased options

@stefcameron
Copy link
Copy Markdown
Member

@stefcameron all good — I would have intuitively thought so too!

😅 What's the best way to verify the typings? Run the file through the TS compiler somehow, or through typescript-eslint? I'd like to add some simple tooling to validate the syntax as part of the quality process.

do you have any idea when the next npm release might happen? am currently installing directly from GitHub as I need one of the unreleased options

I'm currently working on #124 and then will publish an update, most likely 6.0.0 just to be safe because of the path change to main in package.json, though I don't anticipate any breaking changes at all. I hope to publish sometime within the next week.

stefcameron added a commit that referenced this pull request Aug 15, 2020
Fixes #124 to put this repo inline with focus-trap-react:

- update all deps to latest versions
- move to yarn with yarn.lock
- use Webpack to build instead of Browserify (see below
  for more details)
- update Prettier and run on all the source (same rules as
  focus-trap-react)
- add check for types so that problems like #123 don't
  happen again
- (*) fixes bug in package.json 'main' that wasn't pointing to
  /dist/focus-trap.js (build output)

Because of (*) this should be published as a new __major__ release,
just to be safe, even though there shouldn't be any breaking
changes as a result (famous last words...).

This should also close-out a bunch of the security-related
notices on the repo from Dependabot because of old package
versions with vulnerabilities.

Added Webpack builds and removed some deps:

- Webpack Dev and Prod builds, mimicing old Browserify builds.
- Removed Browserify: Webpack replaces.
- Removed uglify: Webpack takes care of this now.
- Removed xtend: simple ES6 object merging works fine.

Fixed 2 small bugs:

- Fixed bug on line 316 of index.js where an NPE would happen
  if the trap was created without `userOptions`; should be
  `config.preventScroll` instead since we create `config` early
  on within the module and use that everywhere instead of
  `userOptions`.
- Fixed bug in allow-click-outside demo by disabling ESC: Otherwise,
  the 'activate trap' button state would get out of sync with
  the state of the trap (would remain 'deactivate trap' after
  pressing ESC).

NOTE: Publishing is still done manually from a local repo.
If we move this repo to Changesets later, we can start
doing releases via GitHub Actions like `focus-trap-react`.
@stefcameron
Copy link
Copy Markdown
Member

What's the best way to verify the typings?

I figured out it's just to add typescript and then tsc index.d.ts, so that's what I've got going on in #125

stefcameron added a commit that referenced this pull request Aug 15, 2020
Fixes #124 to put this repo inline with focus-trap-react:

- update all deps to latest versions
- move to yarn with yarn.lock
- use Webpack to build instead of Browserify (see below
  for more details)
- update Prettier and run on all the source (same rules as
  focus-trap-react)
- add check for types so that problems like #123 don't
  happen again
- (*) fixes bug in package.json 'main' that wasn't pointing to
  /dist/focus-trap.js (build output)

Because of (*) this should be published as a new __major__ release,
just to be safe, even though there shouldn't be any breaking
changes as a result (famous last words...).

This should also close-out a bunch of the security-related
notices on the repo from Dependabot because of old package
versions with vulnerabilities.

Added Webpack builds and removed some deps:

- Webpack Dev and Prod builds, mimicing old Browserify builds.
- Removed Browserify: Webpack replaces.
- Removed uglify: Webpack takes care of this now.
- Removed xtend: simple ES6 object merging works fine.

Fixed 2 small bugs:

- Fixed bug on line 316 of index.js where an NPE would happen
  if the trap was created without `userOptions`; should be
  `config.preventScroll` instead since we create `config` early
  on within the module and use that everywhere instead of
  `userOptions`.
- Fixed bug in allow-click-outside demo by disabling ESC: Otherwise,
  the 'activate trap' button state would get out of sync with
  the state of the trap (would remain 'deactivate trap' after
  pressing ESC).

NOTE: Publishing is still done manually from a local repo.
If we move this repo to Changesets later, we can start
doing releases via GitHub Actions like `focus-trap-react`.
stefcameron added a commit that referenced this pull request Aug 15, 2020
Fixes #124 to put this repo inline with focus-trap-react:

- update all deps to latest versions
- move to yarn with yarn.lock
- use Webpack to build instead of Browserify (see below
  for more details)
- update Prettier and run on all the source (same rules as
  focus-trap-react)
- add check for types so that problems like #123 don't
  happen again
- (*) fixes bug in package.json 'main' that wasn't pointing to
  /dist/focus-trap.js (build output)

Because of (*) this should be published as a new __major__ release,
just to be safe, even though there shouldn't be any breaking
changes as a result (famous last words...).

This should also close-out a bunch of the security-related
notices on the repo from Dependabot because of old package
versions with vulnerabilities.

Added Webpack builds and removed some deps:

- Webpack Dev and Prod builds, mimicing old Browserify builds.
- Removed Browserify: Webpack replaces.
- Removed uglify: Webpack takes care of this now.
- Removed xtend: simple ES6 object merging works fine.

Fixed 2 small bugs:

- Fixed bug on line 316 of index.js where an NPE would happen
  if the trap was created without `userOptions`; should be
  `config.preventScroll` instead since we create `config` early
  on within the module and use that everywhere instead of
  `userOptions`.
- Fixed bug in allow-click-outside demo by disabling ESC: Otherwise,
  the 'activate trap' button state would get out of sync with
  the state of the trap (would remain 'deactivate trap' after
  pressing ESC).

NOTE: Publishing is still done manually from a local repo.
If we move this repo to Changesets later, we can start
doing releases via GitHub Actions like `focus-trap-react`.
stefcameron added a commit that referenced this pull request Aug 17, 2020
Fixes #124 to put this repo inline with focus-trap-react:

- update all deps to latest versions
- move to yarn with yarn.lock
- use Webpack to build instead of Browserify (see below
  for more details)
- update Prettier and run on all the source (same rules as
  focus-trap-react)
- add check for types so that problems like #123 don't
  happen again
- (*) fixes bug in package.json 'main' that wasn't pointing to
  /dist/focus-trap.js (build output)

Because of (*) this should be published as a new __major__ release,
just to be safe, even though there shouldn't be any breaking
changes as a result (famous last words...).

This should also close-out a bunch of the security-related
notices on the repo from Dependabot because of old package
versions with vulnerabilities.

Added Webpack builds and removed some deps:

- Webpack Dev and Prod builds, mimicing old Browserify builds.
- Removed Browserify: Webpack replaces.
- Removed uglify: Webpack takes care of this now.
- Removed xtend: simple ES6 object merging works fine.

Fixed 2 small bugs:

- Fixed bug on line 316 of index.js where an NPE would happen
  if the trap was created without `userOptions`; should be
  `config.preventScroll` instead since we create `config` early
  on within the module and use that everywhere instead of
  `userOptions`.
- Fixed bug in allow-click-outside demo by disabling ESC: Otherwise,
  the 'activate trap' button state would get out of sync with
  the state of the trap (would remain 'deactivate trap' after
  pressing ESC).

NOTE: Publishing is still done manually from a local repo.
If we move this repo to Changesets later, we can start
doing releases via GitHub Actions like `focus-trap-react`.
@michael-ar
Copy link
Copy Markdown
Contributor Author

What's the best way to verify the typings?

I figured out it's just to add typescript and then tsc index.d.ts, so that's what I've got going on in #125

Oh nice one, definitely nice to have as part of the automated flow. Thanks again!

@SeanMcP
Copy link
Copy Markdown
Contributor

SeanMcP commented Sep 5, 2020

@michael-ar Thanks for spotting that! TS is not my forte, though I would never have thought boolean | () => boolean was invalid syntax, but indeed it is.

@stefcameron That makes three of us! I'll file that away for next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants