fix types
This commit is contained in:
parent
22fdde6e39
commit
44cd30b23a
|
@ -16,15 +16,11 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} filePath
|
||||
* @returns {string | null}
|
||||
*/
|
||||
export function getPluginTarget(filePath) {
|
||||
export function getPluginTarget(filePath: string) {
|
||||
const pathParts = filePath.split(/[/\\]/);
|
||||
if (/^index\.tsx?$/.test(pathParts.at(-1))) pathParts.pop();
|
||||
if (/^index\.tsx?$/.test(pathParts.at(-1)!)) pathParts.pop();
|
||||
|
||||
const identifier = pathParts.at(-1).replace(/\.tsx?$/, "");
|
||||
const identifier = pathParts.at(-1)!.replace(/\.tsx?$/, "");
|
||||
const identiferBits = identifier.split(".");
|
||||
return identiferBits.length === 1 ? null : identiferBits.at(-1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue