Open
Conversation
在项目中有时需要判断 sprite对象的 type .
|
Sprite.Type 在大部分时候能用吧…… 我看之前的设计思路像是把这些类型放在静态属性上 |
Author
是的. 你说的对 . Sprite.Type 是值, 但是要用到类型时, 总是要 typeof Sprite.Type 很烦. 我这里确实说写了. 应该是 export type { SpriteType } from './sprite';类似的还有 export type { PixelFormat, TextureFilter, WrapMode } from './asset-enum';他们对应的值是 cc.RenderTexture.PixelFormat/Filter/WrapMode. 不过这个事情 倒是也可以让 开发者自己在项目里 类给类型设置别名 来解决. export type SpriteType = typeof cc.Sprite.Type;
export type PixelFormat = typeof cc.RenderTexture.PixelFormat;
export type TextureFilter = typeof cc.RenderTexture.Filter;
export type WrapMode = typeof cc.RenderTexture.WrapMode;所以这个 PR 倒也不是必须. 不过 有些重要的 类或者值 确实没有导出, 导致开发者难以在项目中进行使用(继承 聚合 实例化 类型声明等). export type { IBatcher } from './i-batcher';
export type { Batcher2D } from './batcher-2d';
export { StaticVBAccessor, StaticVBChunk } from './static-vb-accessor';
export { RenderDrawInfo, RenderDrawInfoType } from './render-draw-info';
export { RenderEntity, RenderEntityType, RenderEntityFillColorType } from './render-entity';
export { Stage, StencilManager } from './stencil-manager';还有 export { TextureBase } from './texture-base'; |
这个最可怕 在deprecated.ts里重命名为 UI 导出了…… |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
在项目中有时需要判断 sprite对象的 type .
Re: #
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: