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

feat(text-field): Convert JS to TypeScript #4377

Merged
merged 37 commits into from
Feb 13, 2019

Conversation

acdvorak
Copy link
Contributor

@acdvorak acdvorak commented Feb 8, 2019

Refs #4225

@kfranqueiro kfranqueiro mentioned this pull request Feb 8, 2019
45 tasks
Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

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

Partial review to send comments so far.

packages/mdc-textfield/adapter.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/types.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/foundation.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/foundation.ts Show resolved Hide resolved
packages/mdc-textfield/foundation.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/foundation.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/foundation.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/index.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/index.ts Show resolved Hide resolved
packages/mdc-textfield/index.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/index.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/index.ts Outdated Show resolved Hide resolved
@acdvorak acdvorak force-pushed the feat/typescript--textfield branch from cea3fad to 3e01b8c Compare February 8, 2019 22:37
@codecov-io
Copy link

codecov-io commented Feb 8, 2019

Codecov Report

Merging #4377 into feat/typescript will increase coverage by 0.17%.
The diff coverage is 99.72%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           feat/typescript    #4377      +/-   ##
===================================================
+ Coverage            98.68%   98.85%   +0.17%     
===================================================
  Files                   94       94              
  Lines                 5987     6051      +64     
  Branches               805      810       +5     
===================================================
+ Hits                  5908     5982      +74     
+ Misses                  78       68      -10     
  Partials                 1        1
Impacted Files Coverage Δ
...ages/mdc-textfield/character-counter/foundation.ts 100% <100%> (ø)
packages/mdc-textfield/icon/index.ts 100% <100%> (ø)
packages/mdc-textfield/character-counter/index.ts 100% <100%> (ø)
packages/mdc-textfield/helper-text/index.ts 100% <100%> (ø)
packages/mdc-textfield/icon/foundation.ts 100% <100%> (ø)
packages/mdc-textfield/helper-text/foundation.ts 100% <100%> (ø)
packages/mdc-textfield/foundation.ts 100% <100%> (ø)
packages/mdc-textfield/index.ts 99.5% <99.5%> (ø)

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 b2fa9a5...03f0022. Read the comment docs.

@mdc-web-bot
Copy link
Collaborator

All 624 screenshot tests passed for commit 8e34f91 vs. feat/typescript! 💯🎉

packages/mdc-textfield/adapter.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/foundation.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/foundation.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/foundation.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/foundation.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/icon/foundation.ts Outdated Show resolved Hide resolved
@mdc-web-bot
Copy link
Collaborator

All 624 screenshot tests passed for commit 44f2987 vs. feat/typescript! 💯🎉

@mdc-web-bot
Copy link
Collaborator

All 624 screenshot tests passed for commit 1c78cf6 vs. feat/typescript! 💯🎉

@mdc-web-bot
Copy link
Collaborator

All 624 screenshot tests passed for commit 730164d vs. feat/typescript! 💯🎉

@mdc-web-bot
Copy link
Collaborator

All 624 screenshot tests passed for commit 1d88400 vs. feat/typescript! 💯🎉

packages/mdc-textfield/foundation.ts Show resolved Hide resolved
*/
isNativeInputValid_() {
private isBadInput_(): boolean {
// The badInput property is not supported in IE 11 💩.
Copy link
Contributor

Choose a reason for hiding this comment

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

I dunno how we feel about your autocompleted emoji ending up in source :P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hah I guess I've gotten used to it and didn't even notice... Personally I think it's hilarious and fitting, but I can remove it if you really want 😛

packages/mdc-textfield/helper-text/index.ts Outdated Show resolved Hide resolved
packages/mdc-textfield/icon/foundation.ts Outdated Show resolved Hide resolved
private input_!: HTMLInputElement; // assigned in initialize()

// Optional sub-elements.
private characterCounter_!: MDCTextFieldCharacterCounter | null; // assigned in initialize()
Copy link
Contributor

Choose a reason for hiding this comment

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

I notice all of these are ! and | null, but you also replaced the ifs below in initialize with ternary expressions. Could these be ? (and not require | null) if we left initialize more intact with ifs? Did doing it this way make anything easier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using null just made the code a little cleaner by condensing the if statements down to ternaries. That's the only reason I did it 😄

Copy link
Contributor

@kfranqueiro kfranqueiro Feb 12, 2019

Choose a reason for hiding this comment

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

I guess since they're all private it doesn't really matter either way. I'm not sure if there's any perception that one is preferable over the other, typing-wise, other than ? existing as a more concise representation of | undefined.

packages/mdc-textfield/index.ts Outdated Show resolved Hide resolved
test/unit/mdc-textfield/foundation.test.js Outdated Show resolved Hide resolved
test/unit/mdc-textfield/foundation.test.js Outdated Show resolved Hide resolved
@mdc-web-bot
Copy link
Collaborator

All 624 screenshot tests passed for commit 530c4c6 vs. feat/typescript! 💯🎉

@mdc-web-bot
Copy link
Collaborator

All 624 screenshot tests passed for commit be64af2 vs. feat/typescript! 💯🎉

import {MDCTextFieldIconFoundation} from './icon/foundation';
import {MDCTextFieldIcon} from './icon/index';

export type NativeInputElement = Pick<HTMLInputElement, 'disabled' | 'maxLength' | 'type' | 'value'> & {
Copy link
Contributor

Choose a reason for hiding this comment

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

NICE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! 🎉 🌮

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 left two comments, but I they are just stylistic. looks good!

@mdc-web-bot
Copy link
Collaborator

All 624 screenshot tests passed for commit c405d56 vs. feat/typescript! 💯🎉

@mdc-web-bot
Copy link
Collaborator

All 624 screenshot tests passed for commit 03f0022 vs. feat/typescript! 💯🎉

@acdvorak acdvorak dismissed kfranqueiro’s stale review February 13, 2019 00:16

Addressed Ken's concerns about unit tests; approved by Matt

@acdvorak acdvorak merged commit 976352c into feat/typescript Feb 13, 2019
@acdvorak acdvorak deleted the feat/typescript--textfield branch February 13, 2019 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants