Skip to content

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 force-pushed the feat/add-protocol-info branch from 564a0f8 to 73af937 Compare June 25, 2024 17:54
@edusperoni edusperoni merged commit 6286203 into main Jun 25, 2024
@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