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

feat(core): infer property type from default value #4150

Merged
merged 1 commit into from Mar 19, 2023
Merged

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Mar 19, 2023

Type inference with reflect-metadata fails when a runtime value is used without an explicit type annotation, e.g. created = new Date instead of created: Data = new Date. This PR infers the default value from the property initializer (if possible) and uses its type in this automatically, so created = new Date will work fine.

Closes #4060

@codecov
Copy link

codecov bot commented Mar 19, 2023

Codecov Report

Patch coverage: 96.66% and project coverage change: +0.01 🎉

Comparison is base (a0a77bc) 99.56% compared to head (6bdc3a1) 99.58%.

Additional details and impacted files
@@            Coverage Diff             @@
##               v6    #4150      +/-   ##
==========================================
+ Coverage   99.56%   99.58%   +0.01%     
==========================================
  Files         217      217              
  Lines       13945    13950       +5     
  Branches     3190     3193       +3     
==========================================
+ Hits        13885    13892       +7     
+ Misses         56       54       -2     
  Partials        4        4              
Impacted Files Coverage Δ
packages/core/src/utils/Configuration.ts 99.25% <ø> (ø)
packages/core/src/utils/Utils.ts 99.79% <ø> (+0.60%) ⬆️
packages/core/src/metadata/MetadataDiscovery.ts 98.39% <92.30%> (-0.13%) ⬇️
packages/core/src/EntityManager.ts 97.03% <100.00%> (ø)
packages/core/src/entity/ArrayCollection.ts 100.00% <100.00%> (ø)
packages/core/src/entity/EntityAssigner.ts 100.00% <100.00%> (ø)
packages/core/src/entity/EntityValidator.ts 100.00% <100.00%> (ø)
packages/core/src/entity/Reference.ts 97.59% <100.00%> (ø)
packages/core/src/enums.ts 100.00% <100.00%> (ø)
packages/core/src/platforms/Platform.ts 99.54% <100.00%> (+<0.01%) ⬆️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@B4nan B4nan merged commit 8ed441e into v6 Mar 19, 2023
7 of 8 checks passed
@B4nan B4nan deleted the default-value-inference branch March 19, 2023 18:26
B4nan added a commit that referenced this pull request Mar 19, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Apr 6, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Apr 10, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Apr 12, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Apr 26, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
jsprw pushed a commit to jsprw/mikro-orm-full-text-operators that referenced this pull request May 7, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes mikro-orm#4060
B4nan added a commit that referenced this pull request May 14, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request May 14, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request May 24, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request May 26, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Jun 11, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Sep 10, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Sep 20, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Sep 24, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Sep 30, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
@B4nan B4nan mentioned this pull request Oct 2, 2023
22 tasks
B4nan added a commit that referenced this pull request Oct 2, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Oct 17, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Oct 21, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Oct 25, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Nov 2, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
B4nan added a commit that referenced this pull request Nov 5, 2023
Type inference with reflect-metadata fails when a runtime value is used
without an explicit type annotation, e.g. `created = new Date` instead
of `created: Data = new Date`. This PR infers the default value from the
property initializer (if possible) and uses its type in this
automatically, so `created = new Date` will work fine.

Closes #4060
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

1 participant