Skip to content

ULL-ESIT-PL/ts-nodesupport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TS and node.js support

References

Examples

Versions

➜  ts-nodesupport git:(main) node --version
v23.5.0
➜  ts-nodesupport git:(main) npm --version
10.9.2

Disable ExperimentalWarning --disable-warning=ExperimentalWarning

  ts-nodesupport git:(main) cat hellots.ts 
function foo(bar: number): string {
  return 'hello';
}
console.log(foo(4));
  ts-nodesupport git:(main) npm run ts hellots.ts

> nodesupport@1.0.0 ts
> node --experimental-transform-types --disable-warning=ExperimentalWarning hellots.ts

hello

Disable warnings --no-warnings

  ts-nodesupport git:(main) cat simple.ts 
type User = {
  name: string;
  age: number;
};

function isAdult(user: User): boolean {
  return user.age >= 18;
}

// Unlike type assertions (`as`), `satisfies` does not change the type of the object but 
// ensures it meets the requirements of the specified type.
const justine = {
  name: 'Justine',
  age: 23,
} satisfies User; 

const isJustineAnAdult = isAdult(justine);

console.log(isJustineAnAdult);

  ts-nodesupport git:(main)  npm start simple.ts

> nodesupport@1.0.0 start
> node --experimental-transform-types --no-warnings simple.ts

true