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: add protocol information to native types #247

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

edusperoni
Copy link
Collaborator

@edusperoni edusperoni commented Apr 10, 2024

This is a possible breaking change

This adds additional information to native types that expect some kind of protocol.

Before:

@protocol Option                                                                                
-(NSString *) optionId;                                 
-(NSString *) type;                    
@end                                      
typedef NSObject<Option> Option; 

@protocol Info                                                                                 
-(NSArray<NSObject<Option> *> *) getOptions;
-(NSObject<Option> *) getOption;
@end
typedef NSObject<Info> Info;

Generated:

interface Option {                                      
                                                        
        optionId(): string;                             
                                                        
        type(): string;                                 
}                                                       
declare var Option: {                                   
                                                        
        prototype: Option;                              
};

interface Info {

	getOption(): NSObject;          
            
        getOptions(): NSArray<NSObject>;
                                           
}                  
declare var Info: {       
                                            
        prototype: Info;          
};

##After

interface Info {

	getOption(): NSObject & Option;

	getOptions(): NSArray<NSObject & Option>;
}
declare var Info: {

	prototype: Info;
};

interface Option {

	optionId(): string;

	type(): string;
}
declare var Option: {

	prototype: Option;
};

Possible breaking change

Types are a bit more strict, so anyone relying on the old types might get a compilation error after this.

Implements #205

@cla-bot cla-bot bot added the cla: yes label Apr 10, 2024
@NathanWalker
Copy link
Contributor

On 8.8.0-alpha.0

@edusperoni edusperoni merged commit 6286203 into main Jun 25, 2024
3 checks passed
@edusperoni edusperoni deleted the feat/add-protocol-info branch June 25, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants