Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

docs: add Ember Data transform page #1410

Merged
merged 2 commits into from
Feb 4, 2022
Merged

docs: add Ember Data transform page #1410

merged 2 commits into from
Feb 4, 2022

Conversation

SergeAstapov
Copy link
Contributor

@SergeAstapov SergeAstapov commented Feb 22, 2021

We started integrating TypeScript into existing application and stumbled upon custom transform.

https://docs.ember-cli-typescript.com/ember-data/models wasn't much helpful so I followed https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50328/files and had to add interface to TransformRegistry to make TypeScript happy:

declare module 'ember-data/types/registries/transform' {
  export default interface TransformRegistry {
    point: PointTransform;
  }
}

after that everything started to work as expected.

I know the prose is really bad but could not came up with anything better. Maybe we can collectively iterate over the prose if the snippets are good here.

@SergeAstapov
Copy link
Contributor Author

Is this actually right/recommended way of extending TransformRegistry? Should we instead recommend to define these via types/registries/transform.d.ts like

export default interface TransformRegistry {
  point: PointTransform;
}

I'm new to ember-cli-typescript so would love to be guinea pig and test existing docs and identify what is missing

@chriskrycho
Copy link
Member

Hi @SergeAstapov – thanks so much for this! I apologize I missed it when it came through; I need to tweak my notifications settings here. I'll try to review it on Friday!

@SergeAstapov
Copy link
Contributor Author

SergeAstapov commented Mar 19, 2021

Thank you @chriskrycho! I updated PR to use more complex example with custom data structure. Please advice if this is not the canonical/suggested way of doing transforms, would love to hear back.

@chriskrycho
Copy link
Member

@jamescdavis mind taking a look at this? You’re more up-to-date and well-informed on Ember Data than I am!

@chriskrycho chriskrycho merged commit eae2261 into typed-ember:master Feb 4, 2022
@chriskrycho
Copy link
Member

I just went ahead and merged this; can iterate later! Thanks @SergeAstapov!

@SergeAstapov SergeAstapov deleted the docs-transform branch February 4, 2022 17:25
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants