UNPKG

1.61 kBSource Map (JSON)View Raw
1{"version":3,"file":"warnDeprecations.js","sourceRoot":"../src/","sources":["warn/warnDeprecations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC5C;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAI,aAAqB,EAAE,KAAQ,EAAE,cAA+B;IAClG,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,KAAK,IAAM,QAAQ,IAAI,cAAc,EAAE;YACrC,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,EAAE;gBAC9B,IAAI,kBAAkB,GAAM,aAAa,mBAAc,QAAQ,wCAAqC,CAAC;gBACrG,IAAM,mBAAmB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;gBACrD,IAAI,mBAAmB,EAAE;oBACvB,kBAAkB,IAAI,WAAS,mBAAmB,eAAY,CAAC;iBAChE;gBACD,IAAI,CAAC,kBAAkB,CAAC,CAAC;aAC1B;SACF;KACF;AACH,CAAC","sourcesContent":["import { ISettingsMap, warn } from './warn';\n/**\n * Warns when a deprecated props are being used.\n *\n * @public\n * @param componentName - The name of the component being used.\n * @param props - The props passed into the component.\n * @param deprecationMap - The map of deprecations, where key is the prop name and the value is\n * either null or a replacement prop name.\n */\nexport function warnDeprecations<P>(componentName: string, props: P, deprecationMap: ISettingsMap<P>): void {\n if (process.env.NODE_ENV !== 'production') {\n for (const propName in deprecationMap) {\n if (props && propName in props) {\n let deprecationMessage = `${componentName} property '${propName}' was used but has been deprecated.`;\n const replacementPropName = deprecationMap[propName];\n if (replacementPropName) {\n deprecationMessage += ` Use '${replacementPropName}' instead.`;\n }\n warn(deprecationMessage);\n }\n }\n }\n}\n"]}
\No newline at end of file