Im coding beginner. I tried import h1 tag So I using document.querySelector function. And I declare variable 'name', but it happens error. why it happens error and how fix that? Fist, This is codes
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>Test</title>
<link rel = "stylesheet" href = "style.css">
</head>
<body>
<div class = "title">
<h1>Grab me!</h1>
</div>
<script type = "text/javascript" src = "script.js"></script>
</body>
</html>
const name = document.querySelector(".title:first-child");
console.dir(name);
It's error(?)
const name: void
@deprecated
'name' is deprecated.ts(6385)
lib.dom.d.ts(17177, 5): The declaration was marked as deprecated here.
I googled but I couldn't find helpful answer (Sorry about my terrible English)