Compare commits
5 Commits
test
...
af9e54deb6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af9e54deb6 | ||
|
|
5adb236aef | ||
|
|
bb5a0840fe | ||
|
|
4372bcd160 | ||
|
|
da8b69577e |
32
error.js
Normal file
32
error.js
Normal file
@@ -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 => <li>{item}</li>);
|
||||
|
||||
const style = { color: 'red', fontWeight: 500 };
|
||||
|
||||
let result = value + 1;
|
||||
|
||||
setCount(count++);
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
<span>Test</span>
|
||||
{list}
|
||||
<button onClick={() => setCount('abc')}>Click</button>
|
||||
<p>{name}</p>
|
||||
</div>
|
||||
<h1>Unwrapped</h1>
|
||||
)
|
||||
}
|
||||
|
||||
export { Demo };
|
||||
32
error.jsx
Normal file
32
error.jsx
Normal file
@@ -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 => <li>{item}</li>);
|
||||
|
||||
const style = { color: 'red', fontWeight: 500 };
|
||||
|
||||
let result = value + 1;
|
||||
|
||||
setCount(count++);
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
<span>Test</span>
|
||||
{list}
|
||||
<button onClick={() => setCount('abc')}>Click</button>
|
||||
<p>{name}</p>
|
||||
</div>
|
||||
<h1>Unwrapped</h1>
|
||||
)
|
||||
}
|
||||
|
||||
export { MyComponent };
|
||||
26
error.php
Normal file
26
error.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use yii\base\Controller;
|
||||
|
||||
class SiteController extends Controller {
|
||||
function actionIndex() {
|
||||
echo $title;
|
||||
|
||||
$id = $_GET['id'];
|
||||
$user = Yii::$app->db->createCommand("SELECT * FROM user WHERE id = $id")->queryOne();
|
||||
|
||||
echo $user['name'];
|
||||
|
||||
echo '<form method="post"><input name="test"></form>';
|
||||
|
||||
$model = new \app\models\User();
|
||||
$model->name = $_POST['name'];
|
||||
$model->save();
|
||||
|
||||
require_once('/var/www/html/config.php');
|
||||
|
||||
throw new Exception('Error!');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
44
error.ts
Normal file
44
error.ts
Normal file
@@ -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;
|
||||
}
|
||||
35
error.tsx
Normal file
35
error.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
type Props = { title?: string };
|
||||
function App(props: Props) {
|
||||
const [count, setCount] = useState<string>(0);
|
||||
|
||||
function unusedFunc(): string {
|
||||
return 'unused';
|
||||
}
|
||||
|
||||
const name = props.username;
|
||||
|
||||
const arr = [1,2,3];
|
||||
const list = arr.map(item => <li>{item}</li>);
|
||||
|
||||
const style = { color: 'red', fontWeight: 500 };
|
||||
|
||||
let result = value + 1;
|
||||
|
||||
setCount(count++);
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
<span>Hello World</span>
|
||||
{list}
|
||||
<button onClick={() => setCount('abc')}>Click</button>
|
||||
<p>{name}</p>
|
||||
</div>
|
||||
<h1>Unwrapped</h1>
|
||||
)
|
||||
}
|
||||
|
||||
export { App };
|
||||
|
||||
const unused = 123;
|
||||
Reference in New Issue
Block a user