Skip to content

Fix of #306 issue with typescript types. #307

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

Merged
merged 1 commit into from
Dec 27, 2017
Merged

Fix of #306 issue with typescript types. #307

merged 1 commit into from
Dec 27, 2017

Conversation

tahq69
Copy link
Contributor

@tahq69 tahq69 commented Dec 27, 2017

Missing type fix for typescript usage
image

@eddyerburgh eddyerburgh merged commit 1482c2b into vuejs:dev Dec 27, 2017
@eddyerburgh
Copy link
Member

Thanks 🙂

@HowdyChad
Copy link

HowdyChad commented Jan 25, 2018

@eddyerburgh Enjoying your book! I'm also trying to utilize TypeScript and have a similar problem to what @tahq69 addressed and fixed here. I want to call a method start, like you do in Chapter 4...

test('should be empty when start is called', () => {
    const wrapper = shallow(ProgressBar)
    wrapper.setData({ progress: 70 }) // default to some previous value
    wrapper.vm.start()
    wrapper.update()
    expect(wrapper.attributes().progress).toBe('0')
})

TypeScript of course has no idea what start() is...
So I can make the compiler happy by changing the line to
;(wrapper.vm as any).start()

(I'm still on the fence about no semicolons btw ;) )

I'm looking for a way that I can explicitly state that my ProgressBar component has a start method.

Do you have any pointers?

Thanks!

@eddyerburgh
Copy link
Member

Hey @kewlniss . Glad you're enjoying the book!

I'm really sorry, but I'm not experienced with TypeScript.

@ktsn do you have any suggestions for @kewlniss 🙏

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.

3 participants