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

fix(fela): get rid of const enum in typings #671

Merged
merged 1 commit into from
Feb 13, 2019

Conversation

layershifter
Copy link
Contributor

Description

Currently fela typings have a single use of const enum and it means that you cannot to build a project with --isolatedModules. See for more details: microsoft/fluent-ui-react#613

Actually, this change is very important because const enums are not supported by @babel/preset-typescript, too.

I added typings for fela-utils as this package contains constants that can be used by consumers.

You should use a union type of literals (string or number) instead.

microsoft/TypeScript#20703 (comment)

Packages

  • fela

Versioning

Actually, it's a breaking change that requires a major bump because you will not able to use TSubscribeMessageType as value.

Before

import { TSubscribeMessageType } from 'fela'

const type = TSubscribeMessageType.rule

After

import { RULE_TYPE } from 'fela-utils'

const type = RULE_TYPE 

Checklist

Quality Assurance

You can also run yarn run check to run all 4 commands at once.

  • The code was formatted using Prettier (yarn run format)
  • The code has no linting errors (yarn run lint)
  • All tests are passing (yarn run test)
  • There are no flow-type errors (yarn run flow)

@robinweser
Copy link
Owner

Hmm so we should have a major version update "just" for those types? Feels somewhat wrong to me, but makes sense...

@layershifter
Copy link
Contributor Author

Hmm so we should have a major version update "just" for those types?

For me: it's fine to ship it as patch 😸

However, if someone really used TSubscribeMessageType as value, it will be a breaking change 🤔 Have mixed feelings about it.

@robinweser robinweser merged commit 3706479 into robinweser:master Feb 13, 2019
@robinweser
Copy link
Owner

Yeah me too. But as someone who does not use TypeScript, this feels super wrong as the actual code is not breaking or anything.
Let's try a patch and see what happens - maybe we learn it should be done with majors 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.

2 participants