Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

feat(linear-progress): Convert JS to TypeScript #4272

Merged
merged 14 commits into from
Jan 23, 2019

Conversation

acdvorak
Copy link
Contributor

@acdvorak acdvorak commented Jan 19, 2019

Refs #4225

Copy link
Contributor

@moog16 moog16 left a comment

Choose a reason for hiding this comment

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

I am also getting lint errors, and some tests errors. Looks like unit tests are not running on this branch since it branches from mdc-animation conversion branch

getPrimaryBar: () => null,
hasClass: (_className: string) => false,
removeClass: (_className: string) => {},
setStyle: (_el: HTMLElement, _styleProperty: string, _value: string) => {},
Copy link
Contributor

Choose a reason for hiding this comment

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

is the _styleProperty better suited as type [key: CSSStyleDeclaration]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we can't use keyof CSSStyleDeclaration here because it lacks vendor prefixes:

const transformStyleProperties = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'MSTransform'];

transformStyleProperties.forEach((transformStyleProperty) => {
this.adapter_.setStyle(el, transformStyleProperty, value);
});

setStyle: (el: HTMLElement, styleProperty: string, value: string) => el.style.setProperty(styleProperty, value),

I'm pretty sure we can get rid of transformStyleProperties because all major browsers now implement transform either unprefixed or -webkit-prefixed, according to Can I Use.

Even so, getCorrectPropertyName() returns StandardCssPropertyName | PrefixedCssPropertyName, which is not directly type-compatible with
keyof CSSStyleDeclaration.

WDYT?

return new MDCLinearProgress(root);
}

set determinate(value) {
set determinate(value: boolean) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ts compiler says it is returning a boolean. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No; I tried adding a return value and got a TypeScript error:

TS2408: Setters cannot return a value

@acdvorak acdvorak changed the base branch from feat/typescript--animation to feat/typescript January 23, 2019 01:09
@codecov-io
Copy link

codecov-io commented Jan 23, 2019

Codecov Report

Merging #4272 into feat/typescript will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           feat/typescript    #4272      +/-   ##
===================================================
+ Coverage            98.57%   98.57%   +<.01%     
===================================================
  Files                   92       92              
  Lines                 5665     5674       +9     
  Branches               757      760       +3     
===================================================
+ Hits                  5584     5593       +9     
  Misses                  81       81
Impacted Files Coverage Δ
packages/mdc-animation/index.ts 100% <ø> (ø) ⬆️
packages/mdc-linear-progress/foundation.ts 100% <100%> (ø)
packages/mdc-linear-progress/index.ts 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8addf4d...2eb71c9. Read the comment docs.

@mdc-web-bot
Copy link
Collaborator

All 758 screenshot tests passed for commit 55e3642 vs. feat/typescript! 💯🎉

Copy link
Contributor

@moog16 moog16 left a comment

Choose a reason for hiding this comment

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

One comment, but looks good to me otherwise.

@mdc-web-bot
Copy link
Collaborator

All 758 screenshot tests passed for commit 2eb71c9 vs. feat/typescript! 💯🎉

@acdvorak acdvorak merged commit 6b958de into feat/typescript Jan 23, 2019
@acdvorak acdvorak deleted the feat/typescript--animation--linear-progress branch January 23, 2019 20:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants