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

Improve typescript declarations #113

Open
Shinigami92 opened this issue Aug 5, 2019 · 3 comments
Open

Improve typescript declarations #113

Shinigami92 opened this issue Aug 5, 2019 · 3 comments
Labels

Comments

@Shinigami92
Copy link

Currently the declarations created in #111 are not very helpful.

Maybe you can improve them and pick up the declarations from here:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/vuex-i18n/index.d.ts

After that we can remove it from DefinitelyTyped

@vuduongq
Copy link
Contributor

vuduongq commented Aug 5, 2019

Hi @Shinigami92

Thanks for providing the typescript declarations. I have updated the d.ts of the package.

@Shinigami92
Copy link
Author

Shinigami92 commented Aug 7, 2019

In which case can this.$t('something') return undefined?

$t(key: string, options?: any, pluralization?: number): string | undefined;

I thought if the key is missing, 'something' will be returned. I think it is never returning undefined.

I use strict in my projects, and after every $t call, I have to append a ! to tell TypeScript that I don't assume undefined.

Edit: Also looking into your code

let defaultValue = '';

The defaultValue is empty string and I think this is a good idea!

@tikiatua
Copy link
Member

Version 2 of the plugin is in the works and completely written in typescript (see version 2 branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants