@@ -6995,6 +6995,18 @@ const testsTypescript = {
69956995 }
69966996 ` ,
69976997 } ,
6998+ {
6999+ code : normalizeIndent `
7000+ function App() {
7001+ const foo = {x: 1};
7002+ React.useEffect(() => {
7003+ const bar = {x: 2};
7004+ const baz = bar as typeof foo;
7005+ console.log(baz);
7006+ }, []);
7007+ }
7008+ ` ,
7009+ } ,
69987010 ] ,
69997011 invalid : [
70007012 {
@@ -7028,6 +7040,40 @@ const testsTypescript = {
70287040 } ,
70297041 ] ,
70307042 } ,
7043+ {
7044+ code : normalizeIndent `
7045+ function App() {
7046+ const foo = {x: 1};
7047+ const bar = {x: 2};
7048+ useEffect(() => {
7049+ const baz = bar as typeof foo;
7050+ console.log(baz);
7051+ }, []);
7052+ }
7053+ ` ,
7054+ errors : [
7055+ {
7056+ message :
7057+ "React Hook useEffect has a missing dependency: 'bar'. " +
7058+ 'Either include it or remove the dependency array.' ,
7059+ suggestions : [
7060+ {
7061+ desc : 'Update the dependencies array to be: [bar]' ,
7062+ output : normalizeIndent `
7063+ function App() {
7064+ const foo = {x: 1};
7065+ const bar = {x: 2};
7066+ useEffect(() => {
7067+ const baz = bar as typeof foo;
7068+ console.log(baz);
7069+ }, [bar]);
7070+ }
7071+ ` ,
7072+ } ,
7073+ ] ,
7074+ } ,
7075+ ] ,
7076+ } ,
70317077 {
70327078 code : normalizeIndent `
70337079 function MyComponent() {
@@ -7233,7 +7279,7 @@ const testsTypescript = {
72337279 code : normalizeIndent `
72347280 function MyComponent() {
72357281 const [state, setState] = React.useState<number>(0);
7236-
7282+
72377283 useEffect(() => {
72387284 const someNumber: typeof state = 2;
72397285 setState(prevState => prevState + someNumber + state);
@@ -7253,7 +7299,7 @@ const testsTypescript = {
72537299 output : normalizeIndent `
72547300 function MyComponent() {
72557301 const [state, setState] = React.useState<number>(0);
7256-
7302+
72577303 useEffect(() => {
72587304 const someNumber: typeof state = 2;
72597305 setState(prevState => prevState + someNumber + state);
@@ -7269,7 +7315,7 @@ const testsTypescript = {
72697315 code : normalizeIndent `
72707316 function MyComponent() {
72717317 const [state, setState] = React.useState<number>(0);
7272-
7318+
72737319 useMemo(() => {
72747320 const someNumber: typeof state = 2;
72757321 console.log(someNumber);
@@ -7287,7 +7333,7 @@ const testsTypescript = {
72877333 output : normalizeIndent `
72887334 function MyComponent() {
72897335 const [state, setState] = React.useState<number>(0);
7290-
7336+
72917337 useMemo(() => {
72927338 const someNumber: typeof state = 2;
72937339 console.log(someNumber);
0 commit comments