Skip to content
This repository was archived by the owner on Mar 5, 2021. It is now read-only.

Replace <Type>x with x as Type (fixes #21) #30

Closed
wants to merge 3 commits into from
Closed

Replace <Type>x with x as Type (fixes #21) #30

wants to merge 3 commits into from

Conversation

Xstoudi
Copy link
Contributor

@Xstoudi Xstoudi commented Jan 10, 2016

I wrote a script who replace every "expression" by "(expression as type)" (#21). It seems to work.

@Xstoudi Xstoudi changed the title Fix superpowers/superpowers/issues#21 Fix #21 Jan 10, 2016
@Xstoudi Xstoudi changed the title Fix #21 Fix issues#21 Jan 10, 2016
@elisee elisee changed the title Fix issues#21 Replace <Type>x with x as Type (fixes #21) Jan 10, 2016
@elisee
Copy link
Contributor

elisee commented Jan 10, 2016

Looks good. Can you amend the commit message & force push your branch? As listed in the documentation:

  • Use imperative in your commits message, for instance Add flux capacitor not Added a flux capacitor
  • If you're fixing a bug with an existing issue number of GitHub, mention it in the commit message: Increase gigawatt output, closes #6

Something like Use "as" keyword for type assertions everywhere, fixes #21 would be great.

Thanks!

@elisee
Copy link
Contributor

elisee commented Jan 10, 2016

Did you try building Superpowers from source with your changes? There are quite a few errors because of misplaced parentheses ^_^.

For instance, in SupCore/Data/Base.index.ts:

  • let items = (rule as string[]).items; Should have been: let items = rule.items as string[];
  • (rule as Rule).items should have been rule.items as Rule

In SupCore/Data/Entries.ts, (this as EntryNode).byId[id] should have been this.byId[id] as EntryNode, etc.

Can you try updating the script to fix it, rebuilding and force pushing a corrected commit?

@Xstoudi
Copy link
Contributor Author

Xstoudi commented Jan 14, 2016

(Sorry for the delay)
I have not managed to create a valid regexp to do this automatically, but the script can find the lines to change.
https://gist.github.com/Xstoudi/dd75d95e0a8a6f1d1c64

@Xstoudi
Copy link
Contributor Author

Xstoudi commented Jan 15, 2016

You can close the other pull request, I failed to rebase...

@elisee
Copy link
Contributor

elisee commented Jan 15, 2016

By the other pull request, you mean this one, right?

@elisee elisee closed this Jan 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants