Skip to main content

ScriptTarget

Enum ScriptTarget 

Source
#[repr(u8)]
pub enum ScriptTarget {
Show 14 variants ES3 = 0, ES5 = 1, ES2015 = 2, ES2016 = 3, ES2017 = 4, ES2018 = 5, ES2019 = 6, ES2020 = 7, ES2021 = 8, ES2022 = 9, ES2023 = 10, ES2024 = 11, ES2025 = 12, ESNext = 99,
}
Expand description

ECMAScript target version.

This determines which language features are available during compilation.

Variants§

§

ES3 = 0

ECMAScript 3 (1999)

§

ES5 = 1

ECMAScript 5 (2009)

§

ES2015 = 2

ECMAScript 2015 (6th Edition)

§

ES2016 = 3

ECMAScript 2016 (7th Edition)

§

ES2017 = 4

ECMAScript 2017 (8th Edition)

§

ES2018 = 5

ECMAScript 2018 (9th Edition)

§

ES2019 = 6

ECMAScript 2019 (10th Edition)

§

ES2020 = 7

ECMAScript 2020 (11th Edition)

§

ES2021 = 8

ECMAScript 2021 (12th Edition)

§

ES2022 = 9

ECMAScript 2022 (13th Edition)

§

ES2023 = 10

ECMAScript 2023 (14th Edition)

§

ES2024 = 11

ECMAScript 2024 (15th Edition)

§

ES2025 = 12

ECMAScript 2025 (16th Edition) — TS6 default (LatestStandard)

§

ESNext = 99

Latest ECMAScript features

Implementations§

Source§

impl ScriptTarget

Source

pub const fn supports_es2016(self) -> bool

Check if this target supports ES2016+ features (exponentiation operator).

Source

pub const fn supports_es2015(self) -> bool

Check if this target supports ES2015+ features (classes, arrows, etc.)

Source

pub const fn supports_es2017(self) -> bool

Check if this target supports ES2017+ features (async, etc.)

Source

pub const fn supports_es2020(self) -> bool

Check if this target supports ES2020+ features (optional chaining, etc.)

Source

pub const fn supports_es2018(self) -> bool

Check if this target supports ES2018+ features (async generators, dotAll regex, etc.)

Source

pub const fn supports_es2019(self) -> bool

Check if this target supports ES2019+ features (optional catch binding).

Source

pub const fn supports_es2021(self) -> bool

Check if this target supports ES2021+ features (logical assignment).

Source

pub const fn supports_es2022(self) -> bool

Check if this target supports ES2022+ features (class fields, regex ‘d’ flag, etc.)

Source

pub const fn supports_es2023(self) -> bool

Check if this target supports ES2023+ features.

Source

pub const fn supports_es2024(self) -> bool

Check if this target supports ES2024+ features.

Source

pub const fn supports_es2025(self) -> bool

Check if this target supports ES2025+ features.

Source

pub const fn is_es5(self) -> bool

Check if this is an ES5 or earlier target (requires downleveling)

Trait Implementations§

Source§

impl Clone for ScriptTarget

Source§

fn clone(&self) -> ScriptTarget

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScriptTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ScriptTarget

Source§

fn default() -> ScriptTarget

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ScriptTarget

Source§

fn eq(&self, other: &ScriptTarget) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ScriptTarget

Source§

impl Eq for ScriptTarget

Source§

impl StructuralPartialEq for ScriptTarget

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.