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

Adding type definitions #19

Merged
merged 17 commits into from Nov 5, 2019

Conversation

@patrick-fs
Copy link
Member

patrick-fs commented Nov 3, 2019

I've added a src/index.d.ts file for type and function signature definitions.

This satisfies issue #17

@sethfowler

@@ -47,6 +47,7 @@ const initOnce = (fn, message) => (...args) => {
window._fs_initialized = true;
};

wrappedFS.init = initOnce(init, 'FullStory init has already been called once. Additional invocations are ignored');
wrappedFS.init = initOnce(init, 'FullStory init has already been called once, additional invocations are ignored');
wrappedFS.anonymize = () => wrappedFS.identify(false);

This comment has been minimized.

Copy link
@patrick-fs

patrick-fs Nov 3, 2019

Author Member

I added anonymize because:

  1. There are plans to add anonymize to the snippet anyway
  2. I twisted myself in knots trying to figure out a meaningful way to express identify(false) as a typed signature: identify(dontAnonymize: boolean) results in a double-negative (ew) and implies that this function call may be required because anonymization is default behavior
  3. identify(true) has no meaning
@patrick-fs patrick-fs requested a review from timjchin Nov 3, 2019
patrick-fs added 4 commits Nov 3, 2019
Copy link

craigrmccown left a comment

Very nice! LGTM

patrick-fs added 2 commits Nov 4, 2019
@patrick-fs patrick-fs merged commit 3ca33b5 into master Nov 5, 2019
1 check passed
1 check passed
ci/circleci: build-browser-sdk Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.