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

[SERVICE-875] Create @types module for runtime-based FDC3 #1

Open
wants to merge 11 commits into
base: fdc3
Choose a base branch
from

Conversation

bryangaleopenfin
Copy link

@bryangaleopenfin bryangaleopenfin commented Jan 17, 2020

Notes

  • The setup in index.d.ts doesn't seem optimal, but it's the only solution I've found that allows the global FDC3 object to be imported automatically within the tsconfig file using types: ["openfin-fdc3-global"], and used without VS complaining that I should be using a module import. Basically, any use of import or export at the top level in index.d.ts will cause TS to regard it as a module, which then means VS complains when we want to just use it as a global

  • The comment on index.d.ts is adapted from the @types\openfin index.d.ts

Generation steps

  • Grab *.d.ts files generated by FDC3 build process (types in this PR were taken from master)

  • Remove connection.d.ts and validation.d.ts files, and most of the constants of internal.d.ts (all but SystemChannelTransport, AppChannelTransport and ChannelTransport), as these expose types we don't want exposed. (There's a few other stray definitions to remove)

  • Remove @module declarations as these upset the linter

  • Replace all occurrences of "export declare" with "export", to satisfy the linter

  • Add tslint:disable-next-line no-any-union to line in main.d.ts to satisfy linter

  • Manually create index.d.ts

Proposed PR text for DefinitelyTyped

OpenFin is a Chromium-based runtime for authoring financial applications. FDC3 is a standard for allowing interoperation between financial applications.

This PR provides types for the OpenFin implementation of FDC3, which OpenFin applications can use via the fdc3 object, which is injected into the global namespace. This is similar to how the current @types/openfin package provides types for the global fin object that is available within OpenFin runtime.

Though there is currently an openfin-fdc3 npm package with types, this will soon be deprecated in favour of this automatic injection approach, hence the need for this types package.

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If adding a new definition:

  • The package does not already provide its own types, or cannot have its .d.ts files generated via --declaration
  • If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • Represents shape of module/library correctly
  • tslint.json should be present and it shouldn't have any additional or disabling of rules. Just content as { "extends": "dtslint/dt.json" }. If for reason the some rule need to be disabled, disable it for that line using // tslint:disable-next-line [ruleName] and not for whole package so that the need for disabling can be reviewed.
  • tsconfig.json should have noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes set to true.

@bryangaleopenfin bryangaleopenfin marked this pull request as ready for review January 21, 2020 14:52
Copy link

@pjbroadbent pjbroadbent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a super-quick one liner description of what FDC3 is, for the DT reviewers? As per the first line and OpenFin. Or link the first mention of FDC3 to fdc3.finos.org.

types/openfin-fdc3/index.d.ts Outdated Show resolved Hide resolved
types/openfin-fdc3/index.d.ts Outdated Show resolved Hide resolved
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.

2 participants