Yes this is possible. The tiff must be saved within a dynamic workspace of a map service. Here's the 3.x documentation: RasterDataSource | API Reference | ArcGIS API for JavaScript 3.20
Hello Kristian, Thank you for your reply, but I wan"t to import a raster image directly like a drag-and-drop or upload