“parserOptions.project” has been set for @typescript-eslint/parser

Different lint rules for JavaScript and TypeScript files The problem happens for one of the reasons below: You’re using a rule which require type information and didn’t specify a parserOptions.project; You specified parserOptions.project, didn’t specify createDefaultProgram (it will be removed in a future version), and you’re linting files not included in the project (e.g. babel.config.js, … Read more

TypeScript – use correct version of setTimeout (node vs window)

let timer: ReturnType<typeof setTimeout> = setTimeout(() => { … }); clearTimeout(timer); By using ReturnType<fn> you are getting independence from platform. You won’t be forced to use neither any nor window.setTimeout which will break if you run the code on nodeJS server (eg. server-side rendered page). Good news, this is also compatible with Deno!

Define global constants

Below changes works for me on Angular 2 final version: export class AppSettings { public static API_ENDPOINT=’http://127.0.0.1:6666/api/’; } And then in the service: import {Http} from ‘angular2/http’; import {Message} from ‘../models/message’; import {Injectable} from ‘angular2/core’; import {Observable} from ‘rxjs/Observable’; import {AppSettings} from ‘../appSettings’; import ‘rxjs/add/operator/map’; @Injectable() export class MessageService { constructor(private http: Http) { } … Read more

Using eslint with typescript – Unable to resolve path to module

You can set the ESLint module import resolution by adding this snippet to your .eslintrc.json configuration file: { “settings”: { “import/resolver”: { “node”: { “extensions”: [“.js”, “.jsx”, “.ts”, “.tsx”] } } }, … } More informations about resolvers: https://github.com/benmosher/eslint-plugin-import#resolvers.

Unable to import svg files in typescript

If you use webpack, you can do this by creating a custom types file. Create a file named custom.d.ts with the following content: declare module “*.svg” { const content: any; export default content; } Add the custom.d.ts to tsconfig.json as below “include”: [“src/components”, “src/custom.d.ts”] Source: https://webpack.js.org/guides/typescript/#importing-other-assets

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)