-
Notifications
You must be signed in to change notification settings - Fork 35
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
Activate strictBindCallApply and strictFunctionTypes compiler rules #2880
Conversation
lindner
commented
Apr 11, 2019
- Improves types in api-channel and slot-consumer
- Introduce option types for startRender and stopRender
- Fix mismatched Map/object types in providedSlots
- Use specific types in Literalizer
- Improves types in api-channel and slot-consumer - Introduce option types for startRender and stopRender - Fix mismatched Map/object types in providedSlots - Use specific types in Literalizer
prototype: {toLiteral: () => TypeLiteral}; | ||
fromLiteral: (typeliteral: TypeLiteral) => Type; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little hacky, but describes the current usage. Should ParticleSpec/PropagatedException implement Type/TypeLiteral instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to templatize literalizer on the literal type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to parameterize Literalizer, but none of them survived the use of decorators with any fidelity.
I also started down the path of creating a new Literalizable interface but ran into the same issues with adding Types to EnityType (namely lack of static methods in interfaces microsoft/TypeScript#14600) Especially with generics.
Since the latter solution is preferred, but also much more invasive I'll spin those changes out to another cleanup issue.
@@ -415,7 +425,7 @@ export abstract class PECOuterPort extends APIPort { | |||
UIEvent(@Mapped particle: recipeParticle.Particle, @Direct slotName: string, @Direct event: {}) {} | |||
SimpleCallback(@RemoteMapped callback: number, @Direct data: {}) {} | |||
AwaitIdle(@Direct version: number) {} | |||
StartRender(@Mapped particle: recipeParticle.Particle, @Direct slotName: string, @ObjectMap(MappingType.Direct, MappingType.Direct) providedSlots: {[index: string]: string}, @List(MappingType.Direct) contentTypes: string[]) {} | |||
StartRender(@Mapped particle: recipeParticle.Particle, @Direct slotName: string, @ObjectMap(MappingType.Direct, MappingType.Direct) providedSlots: Map<string, string>, @List(MappingType.Direct) contentTypes: string[]) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the new checks caught this type mismatch. (Should be Map<string,string>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(But please try to get the literalizer templated before submitting - that's the long-term direction that toLiteral/fromLiteral needs to go in)
prototype: {toLiteral: () => TypeLiteral}; | ||
fromLiteral: (typeliteral: TypeLiteral) => Type; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to templatize literalizer on the literal type.
@@ -415,7 +425,7 @@ export abstract class PECOuterPort extends APIPort { | |||
UIEvent(@Mapped particle: recipeParticle.Particle, @Direct slotName: string, @Direct event: {}) {} | |||
SimpleCallback(@RemoteMapped callback: number, @Direct data: {}) {} | |||
AwaitIdle(@Direct version: number) {} | |||
StartRender(@Mapped particle: recipeParticle.Particle, @Direct slotName: string, @ObjectMap(MappingType.Direct, MappingType.Direct) providedSlots: {[index: string]: string}, @List(MappingType.Direct) contentTypes: string[]) {} | |||
StartRender(@Mapped particle: recipeParticle.Particle, @Direct slotName: string, @ObjectMap(MappingType.Direct, MappingType.Direct) providedSlots: Map<string, string>, @List(MappingType.Direct) contentTypes: string[]) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Deferring templatization. I agree that it is the better way to go; despite Typescript being not amenable to a simple solution... |
…olymerLabs#2880) * Fix firebase strictFunctionTypes violation * Activate strictBindCallApply and strictFunctionTypes compiler rules - Improves types in api-channel and slot-consumer - Introduce option types for startRender and stopRender - Fix mismatched Map/object types in providedSlots - Use specific types in Literalizer