GithubHelp home page GithubHelp logo

Comments (5)

chriskrycho avatar chriskrycho commented on June 2, 2024

Confirm: current implementation only picks up ts as the extension.

from ember-cli-typescript.

chriskrycho avatar chriskrycho commented on June 2, 2024

The problem was actually in the includeExtensions argument to the TsPreprocessor constructor.

from ember-cli-typescript.

chriskrycho avatar chriskrycho commented on June 2, 2024

An alternative approach to consider: stop setting weird values in the tsconfig and see what happens.

from ember-cli-typescript.

leepfrog avatar leepfrog commented on June 2, 2024

Here's my tsconfig.json -- it seems to be working with new types defined correctly with the app/config folder (eg: app/config/<module_name>.d.ts)

// tsconfig.json
{
  "compilerOptions": {
    "target": "ES6",
    "allowJs": true,
    "moduleResolution": "node",
    "noEmitOnError": false,
    "noEmit": true,
    "baseUrl": ".",
    "paths": {
      "mycoolappname/*": ["app/*"],
      "mycoolappname/tests/*": ["tests/*"],
      "mycoolappname/mirage/*": ["mirage/*"]
    }
  },
  "include": [
    "app/**/*",
    "tests/**/*",
    "mirage/**/*"
  ]
}

an example of defining support for a module that defines globals:

// app/config/ember-testing.d.ts
declare var visit: (path: string) => PromiseConstructor;
declare var triggerEvent: (selector: string | JQuery, event: string) => PromiseConstructor;
declare var click: (selector: string | JQuery) => PromiseConstructor;
declare var find: (selector: string | JQuery) => JQuery;

an example of defining support for a module that you import from:
app/config/qunit.d.ts
see: https://gist.github.com/leepfrog/0c08bd20ab54a0ba957a4504e87703cf

an example of defining support for something you're going to only use in TS (eg: I converted all of my /mirage folder to TS):

// app/config/ember-cli-mirage.d.ts
declare namespace Mirage {
  export namespace Model {
    export interface Base {
      id: string;
    }

    // I'll move this into app/models/my-cool-model.ts when it's no longer .js (it would be nice to have ember-cli-typescript auto-define these modules in appropriate namespaces if that makes sense?)
    export interface MyCoolModel extends Base {

    }
    // ....
  }
}

declare var server: any;  

BTW -- not sure if I'm doing it right (hey - we all get to be new!) -- but it seems to work.

from ember-cli-typescript.

chriskrycho avatar chriskrycho commented on June 2, 2024

Thanks, @leepfrog! That's a super helpful bit of data. It confirms that the problem was indeed resolved with #22 (as I thought it would be).

from ember-cli-typescript.

Related Issues (20)

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.