Code Monkey home page Code Monkey logo

coerce-property's Introduction

Hi there 👋

I'm a frontend developer who's passionate about Angular and creating open-source projects. If you have any questions or suggestions, feel free to shoot me a message. Thanks for checking out my profile, and keep calm and code on!

coerce-property's People

Contributors

a77ay avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wch-grzegorz

coerce-property's Issues

Type 'string' is not assignable to type 'boolean'

In my component I have declared the following input:

@Input() @coerceBoolean public multiple: boolean = false;

Trying to use it like <component multiple></component> gives me the following error:

TS2322: Type 'string' is not assignable to type 'boolean'.

I'm using the following tsconfig:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "target": "ES2022",
    "module": "es2020",
    "moduleResolution": "node",
    "downlevelIteration": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "skipLibCheck": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noEmitHelpers": true,
    "importHelpers": true,
    "pretty": true,
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2020",
      "dom"
    ],
    "useDefineForClassFields": false
  },
  "angularCompilerOptions": {
    "strictInjectionParameters": true,
    "strictMetadataEmit": false,
    "fullTemplateTypeCheck": true,
    "strictTemplates": true
  },
  "atom": {
    "rewriteTsconfig": false
  }
}

Any ideas?

Enabling TSConfig strict mode result to TS2322

Hi, by enabling the "strict": true, in typescript compiler a.k.a. tsconfig.json it will result to the following Typescript error

TS2322: Type '(target: T, propertyKey: P) => void' is not assignable to type 'PropertyDecorator'.   Types of parameters 'target' and 'target' are incompatible.     Type 'Object' is not assignable to type 'T'.       'T' could be instantiated with an arbitrary type which could be unrelated to 'Object'

return function(target: T, propertyKey: P) {

Error during template compile of 'coerceBoolean'

Hi, after trying to use this tool following error throws:

Compiling TypeScript sources through ngc
ERROR: coerce-property/lib/coercions.ts(1,22): Error during template compile of 'coerceBoolean'
Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler.

Looks really useful for me, but is this still working in ng 9? :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.