Can't Run Typescript Code with Decorators
I Have This Two Simple Files but Every Time I Try to Run the testClass. Ts I Get This Error: Ps C: \Deno\Pancakes> Deno Run testClass. Ts Compile File: ///C...
I have this two simple files but every time I try to run the testClass.ts I get this error:
PS C:\Deno\pancakes> deno run testClass.ts
Compile file:///C:/Deno/pancakes/testClass.ts
error: TS1219 [ERROR]: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
name: string;
~~~~
at file:///C:/Deno/pancakes/testClass.ts:5:5
testClass.ts
import { notNull } from "./mod.ts";
class Person {
@notNull
name: string;
constructor(name: string) {
this.name = name;
}
}
let newPerson = new Person("");
mod.ts
export function notNull(target: any, propertyKey: string) {
console.log(target, propertyKey);
}
I have already enable the experimentalDecorators option in VSCode, create the tsconfig.json and everything but still can't run the program. I't doesn't show the error in VSCode but can't run.
Edit: this is what happens
1 Answer
With deno you need to explicitly specify your tsconfig,
> deno run -c tsconfig.json testClass.ts