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: changing FormatHelpers.setSwiftFileProperties type function to return object #1176

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vsjolander
Copy link

@vsjolander vsjolander commented May 2, 2024

Docs specify that return type should be Object but it's string in FormatHelpers.d.ts file.

Description of changes:
changing FormatHelpers.setSwiftFileProperties type function to return object

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@vsjolander vsjolander requested a review from a team as a code owner May 2, 2024 12:44
types/FormatHelpers.d.ts Outdated Show resolved Hide resolved
@jorenbroekema
Copy link
Collaborator

Sidenote: in v4 branch this is fixed already

@vsjolander vsjolander changed the base branch from main to v4 May 2, 2024 16:06
@vsjolander vsjolander changed the base branch from v4 to master May 2, 2024 16:06
@vsjolander vsjolander changed the base branch from master to main May 2, 2024 17:14
Co-authored-by: Joren Broekema <joren.broekema@gmail.com>
@vsjolander
Copy link
Author

@jorenbroekema couldn't find this type in the v4 branch but the helpers seems to still be there. Did I overlook something maybe?

Added your changes if you want add them. Thanks for your time.

@jorenbroekema
Copy link
Collaborator

jorenbroekema commented May 2, 2024

In v4 the type interfaces aren't separated from the JS code itself anymore, typescript support is now first-class.

If you really need the interface separated you could do this:

import { setSwiftFileProperties } from 'style-dictionary/utils';

const foo = setSwiftFileProperties(...);
//    ^^^   foo is typed implicitly because the return type of setSwiftFileProperties is known, no more need to typecast it

// if you really need the return type itself:
declare type fooType = typeof foo;

More info: https://v4.styledictionary.com/version-4/migration/#types

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.

None yet

2 participants