Sentry/V8/Removal Severity Enum

/icons/calendar.svg

Last update

Aug 24, 2024

Codemod to replace the deprecated Severity enum with the SeverityLevel type in Sentry from version 7.x to 8.x.

Example

Before

import { Severity } from '@sentry/types';

After

import { SeverityLevel } from '@sentry/types';

,

Before

const level = Severity.error;

After

const level: SeverityLevel = 'error';

,

Before

const warningLevel = Severity.warning;
const infoLevel = Severity.info;

After

const warningLevel: SeverityLevel = 'warning';
const infoLevel: SeverityLevel = 'info';

,

Before

let currentLevel = Severity.fatal;

After

let currentLevel: SeverityLevel = 'fatal';

,

Before

function getSeverity() {
return Severity.debug;
}

After

function getSeverity(): SeverityLevel {
return 'debug';
}

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now