diff --git a/error.js b/error.js new file mode 100644 index 0000000..b83325b --- /dev/null +++ b/error.js @@ -0,0 +1,32 @@ +import React, { useState } from 'react'; + +function Demo(props) { + const [count, setCount] = useState('0'); + + function unusedFunc() { + return 'unused'; + } + + const name = props.username; + + const arr = [1,2,3]; + const list = arr.map(item =>
  • {item}
  • ); + + const style = { color: 'red', fontWeight: 500 }; + + let result = value + 1; + + setCount(count++); + + return ( +
    + Test + {list} + +

    {name}

    +
    +

    Unwrapped

    + ) +} + +export { Demo }; diff --git a/error.jsx b/error.jsx new file mode 100644 index 0000000..7b3beeb --- /dev/null +++ b/error.jsx @@ -0,0 +1,32 @@ +import React, { useState } from 'react'; + +function MyComponent(props) { + const [count, setCount] = useState('0'); + + function unusedFunc() { + return 'unused'; + } + + const name = props.username; + + const arr = [1,2,3]; + const list = arr.map(item =>
  • {item}
  • ); + + const style = { color: 'red', fontWeight: 500 }; + + let result = value + 1; + + setCount(count++); + + return ( +
    + Test + {list} + +

    {name}

    +
    +

    Unwrapped

    + ) +} + +export { MyComponent }; diff --git a/error.php b/error.php new file mode 100644 index 0000000..3b1cc4b --- /dev/null +++ b/error.php @@ -0,0 +1,26 @@ +db->createCommand("SELECT * FROM user WHERE id = $id")->queryOne(); + + echo $user['name']; + + echo '
    '; + + $model = new \app\models\User(); + $model->name = $_POST['name']; + $model->save(); + + require_once('/var/www/html/config.php'); + + throw new Exception('Error!'); + + return true; + } +} diff --git a/error.ts b/error.ts new file mode 100644 index 0000000..241825b --- /dev/null +++ b/error.ts @@ -0,0 +1,44 @@ +function add(a: number, b: number): number { + return a + b +} + +const result = add('1', 2); +console.log(result) + +let unusedVar: string; + +function getString(): number { + return "hello" +} + +let neverUsed = 123; + +let x: any = "abc"; +let y: number = x as number; + +let a = 5; +function shadow() { + let a = "shadowed"; + return a; +} + +function noReturnType() { + return true; +} + +interface User { + name: string; + age: number; +} +const user: User = { name: "A", age: "20" }; + +const arr: number[] = [1, "2", 3]; + +function unreachable() { + return 1; + console.log("This will never run"); +} + +function useAny(a: any, b: any): any { + return a + b; +} diff --git a/error.tsx b/error.tsx new file mode 100644 index 0000000..db9ecac --- /dev/null +++ b/error.tsx @@ -0,0 +1,35 @@ +import React, { useState } from 'react'; + +type Props = { title?: string }; +function App(props: Props) { + const [count, setCount] = useState(0); + + function unusedFunc(): string { + return 'unused'; + } + + const name = props.username; + + const arr = [1,2,3]; + const list = arr.map(item =>
  • {item}
  • ); + + const style = { color: 'red', fontWeight: 500 }; + + let result = value + 1; + + setCount(count++); + + return ( +
    + Hello World + {list} + +

    {name}

    +
    +

    Unwrapped

    + ) +} + +export { App }; + +const unused = 123;