mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 12:51:57 +00:00
docs(ast): improve docs examples for PropertyDefinition (#7287)
This commit is contained in:
parent
b57d00d6fb
commit
f0affa20c6
1 changed files with 15 additions and 14 deletions
|
|
@ -1928,13 +1928,14 @@ pub struct PropertyDefinition<'a> {
|
||||||
/// Initialized value in the declaration.
|
/// Initialized value in the declaration.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```
|
/// ```ts
|
||||||
/// class Foo {
|
/// class Foo {
|
||||||
/// x = 5 // Some(NumericLiteral)
|
/// x = 5; // Some(NumericLiteral)
|
||||||
/// y: string // None
|
/// y; // None
|
||||||
|
/// z: string; // None
|
||||||
///
|
///
|
||||||
/// constructor() {
|
/// constructor() {
|
||||||
/// this.y = "hello"
|
/// this.z = "hello";
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
@ -1942,10 +1943,10 @@ pub struct PropertyDefinition<'a> {
|
||||||
/// Property was declared with a computed key
|
/// Property was declared with a computed key
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```ts
|
/// ```js
|
||||||
/// class Foo {
|
/// class Foo {
|
||||||
/// ["a"]: string // true
|
/// ["a"]: 1; // true
|
||||||
/// b: number // false
|
/// b: 2; // false
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub computed: bool,
|
pub computed: bool,
|
||||||
|
|
@ -1956,12 +1957,12 @@ pub struct PropertyDefinition<'a> {
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```ts
|
/// ```ts
|
||||||
/// class Foo {
|
/// class Foo {
|
||||||
/// x: number // false
|
/// x: number; // false
|
||||||
/// declare y: string // true
|
/// declare y: string; // true
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// declare class Bar {
|
/// declare class Bar {
|
||||||
/// x: number // false
|
/// x: number; // false
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[ts]
|
#[ts]
|
||||||
|
|
@ -1989,10 +1990,10 @@ pub struct PropertyDefinition<'a> {
|
||||||
///
|
///
|
||||||
/// ```ts
|
/// ```ts
|
||||||
/// class Foo {
|
/// class Foo {
|
||||||
/// public w: number // Some(TSAccessibility::Public)
|
/// public w: number; // Some(TSAccessibility::Public)
|
||||||
/// private x: string // Some(TSAccessibility::Private)
|
/// private x: string; // Some(TSAccessibility::Private)
|
||||||
/// protected y: boolean // Some(TSAccessibility::Protected)
|
/// protected y: boolean; // Some(TSAccessibility::Protected)
|
||||||
/// readonly z // None
|
/// readonly z; // None
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[ts]
|
#[ts]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue