Add lightning:actionOverride and lightning:hasPageReference to the list of interfaces in the aura:component tag.
Sample Code:
Lightning Component:
<aura:component implements="lightning:actionOverride, lightning:hasPageReference" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
</aura:component>
Lightning Component JavaScript Controller:
({
doInit: function(component, event, helper) {
//Fetching Record Type Id
var recordTypeId = component.get( "v.pageReference" ).state.recordTypeId;
alert( recordTypeId );
}
})
Output: